| | |
What Could be wrong here!!!
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
i have been using adodc for searching for a client's details using the client number, but it would give me inexpected errors and bomb out of my programme. i have then resorted to searching using sql. the following code gives me this error:::
no value given for one or more required parameters
this error is pointed at line 7 in the following code.
the code thats producing this error is:::
can you help me please!!!
no value given for one or more required parameters
this error is pointed at line 7 in the following code.
the code thats producing this error is:::
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdcnsearch_Click() sql = "Select companyname,companysize,country,city from cooperate where CSTR(accnumber)='" & txtcnsearch.Text & "'" Set conn = New Connection Set r = New Recordset conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Subscriptions Project\subscriptions.mdb" With r .Open sql, conn, adOpenKeyset, adLockOptimistic, adCmdText If .EOF Then MsgBox "Record not found", vbExclamation txtcnsearch.SelStart = 0 txtcnsearch.SelLength = Len(txtcnsearch.Text) txtcnsearch.SetFocus Exit Sub 'to populate the field Else txtccname = r!CompanyName txtcsize.Text = r!companysize txtcountry.Text = r!country txtcity.Text = r!city r.Close End If End With End Sub
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
0
#2 Oct 22nd, 2009
since im the one who posted this thread let me just add on something.
i have tried a different method for searching and its now telling me another different error. the error is::
object variable or with block variable not set
the code thats giving this error is:::::
i have tried a different method for searching and its now telling me another different error. the error is::
object variable or with block variable not set
the code thats giving this error is:::::
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim uid As Variant uid = txtcnamesearch If uid = "" Then Exit Sub r.Find "membernumber=" & uid If r.EOF = True Then mymessage = MsgBox("Account does not exist, Please create account first", vbCritical, "Account Not Found") txtcnamesearch = "" txtcnamesearch.SetFocus r.MoveFirst Else txtccname = r("companyname") txtcsize = r("companysize") txtccountry = r("country") End If
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
0
#3 Oct 22nd, 2009
since im the one who posted this thread let me just add on something.
i have tried a different method for searching and its now telling me another different error. the error is::
object variable or with block variable not set
the code thats giving this error is:::::
i have tried a different method for searching and its now telling me another different error. the error is::
object variable or with block variable not set
the code thats giving this error is:::::
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim uid As Variant uid = txtcnamesearch If uid = "" Then Exit Sub r.Find "membernumber=" & uid If r.EOF = True Then mymessage = MsgBox("Account does not exist, Please create account first", vbCritical, "Account Not Found") txtcnamesearch = "" txtcnamesearch.SetFocus r.MoveFirst Else txtccname = r("companyname") txtcsize = r("companysize") txtccountry = r("country") End If
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Solved Threads: 1
0
#6 Oct 22nd, 2009
Try placing brackets around CSTR(accnumber) so it looks like this:
[CSTR(accnumber)]
I'm assuming it's the name of a field.
[CSTR(accnumber)]
I'm assuming it's the name of a field.
•
•
•
•
i have been using adodc for searching for a client's details using the client number, but it would give me inexpected errors and bomb out of my programme. i have then resorted to searching using sql. the following code gives me this error:::
no value given for one or more required parameters
this error is pointed at line 7 in the following code.
the code thats producing this error is:::
can you help me please!!!Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdcnsearch_Click() sql = "Select companyname,companysize,country,city from cooperate where CSTR(accnumber)='" & txtcnsearch.Text & "'" Set conn = New Connection Set r = New Recordset conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Subscriptions Project\subscriptions.mdb" With r .Open sql, conn, adOpenKeyset, adLockOptimistic, adCmdText If .EOF Then MsgBox "Record not found", vbExclamation txtcnsearch.SelStart = 0 txtcnsearch.SelLength = Len(txtcnsearch.Text) txtcnsearch.SetFocus Exit Sub 'to populate the field Else txtccname = r!CompanyName txtcsize.Text = r!companysize txtcountry.Text = r!country txtcity.Text = r!city r.Close End If End With End Sub
•
•
Join Date: Jan 2008
Posts: 255
Reputation:
Solved Threads: 38
0
#7 Oct 22nd, 2009
Follow my comment lines within your code...
Hope this solves your problem. With your second error, is your connection referenced?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdcnsearch_Click() 'dim sql as string sql = "Select companyname,companysize,country,city from cooperate where CSTR(accnumber)='" & txtcnsearch.Text & "'" 'sql = "Select companyname,companysize,country,city from 'cooperate where accnumber=" & "'" & txtcnsearch.Text & "'" 'remove the cstr for the value you are looking for is in a field, which 'is the value that will be returned. Set conn = New Connection Set r = New Recordset conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Subscriptions Project\subscriptions.mdb" With r .Open sql, conn, adOpenKeyset, adLockOptimistic, adCmdText If .EOF Then MsgBox "Record not found", vbExclamation txtcnsearch.SelStart = 0 txtcnsearch.SelLength = Len(txtcnsearch.Text) txtcnsearch.SetFocus Exit Sub 'to populate the field Else txtccname = r!CompanyName txtcsize.Text = r!companysize txtcountry.Text = r!country txtcity.Text = r!city r.Close End If End With End Sub
Hope this solves your problem. With your second error, is your connection referenced?
Please mark questions as answered when done.
Be the ONE!!!
Be the ONE!!!
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
0
#8 Oct 22nd, 2009
when i make the changes it gives me a whole new error...its now saying
syntax error in querry. Incomplete query close
and its pointing to the following section of my code....
so what could be causing that.
syntax error in querry. Incomplete query close
and its pointing to the following section of my code....
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
With r .Open sql, conn, adOpenKeyset, adLockOptimistic, adCmdText
so what could be causing that.
![]() |
Similar Threads
- My CD-RW plays but won't burn. What could be wrong?? Help Please? (Storage)
- Retrieve email I sent to the wrong person (Web Browsers)
- Ram voltage wrong?? (Motherboards, CPUs and RAM)
- Am I going about this the wrong way (IT Professionals' Lounge)
- wats wrong with imesh??? (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: change Printer And Fax Default Printer From VB6
- Next Thread: VB 6 Error 75 Path File Access
Views: 474 | Replies: 11
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection copy creat ctrl+f data database datareport date delete dissertations dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





