Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No value given for one or more required parameters...

Status
Not open for further replies.

OrthoDocSoft

Programmer
May 7, 2004
291
US
Folks, I'm an obvious newbie to databases and I'm having problems. Here's my stuff:

DATABASE (ACCESS 2002 FORMAT)

Name of database: MyDatabase.mdb

Table: MyTable

Fields in MyTable: Name, IDNumber(autonumber)


VB6 CODE

In a basic module, I have declared

Code:
Public adoConnection As ADODB.Connection
Public connectString as String

In MyForm_general I have:

Code:
Dim strRecordNameImSearchingFor As String

In MyForm_load sub I have:

Code:
Dim adoRSMyRecordset As ADODB.Recordset

Set adoConnection = New ADODB.Connection

connectString = "Provider = Microsoft.jet.oledb.4.0;" _
& "Data Source=C:\Program Files\microsoft visual studio\vb98\databases\MyDatabase.mdb"

adoConnection.Open connectString

Set adoRSMyRecordset = New ADODB.Recordset

strRecordNameImSearchingFor = Trim(txtMyTextbox.Text)

adoRSMyRecordset.Open ("SELECT * FROM MyTable WHERE" _
& " Name = " & strRecordImSearchingFor), adoConnection, _
adOpenKeyset, adLockOptimistic

The point is to generate a recordset here that basically has one record in it which should match the string obtained from the textbox. When I run this I get the following error message:

"No value given for one or more required parameters."

Can anyone see what parameter(s) I am not providing?

Thank you,

Ortho [lookaround]
 
I figured it out. I needed this line instead"

Code:
adoRSMyRecordset.Open ("SELECT * FROM MyTable WHERE" _
& " Name =[COLOR=red] '[/color]" & strRecordImSearchingFor) & [COLOR=red]"'"[/color], adoConnection, _
adOpenKeyset, adLockOptimistic

Sorry to bother you all.
Ortho [lookaround]
 
Hi. Just a guess, but because your Name is text, I think you have to qualify it. Try changing

" Name = " & strRecordImSearchingFor
to
" Name = '" & strRecordImSearchingFor & "'"

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top