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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting using adodc record source

Status
Not open for further replies.

daz321

Programmer
May 31, 2002
17
GB
I have a form that displays a letter history, basically the contents of a table, i would like to be able to search on various criteria, i am using the below code to search on letter_type but get a "No value given for one or more required parameters" error message.


Private Sub cmdLetterType_Click()
Dim LetterType As String

LetterType = InputBox("Enter the Letter Type:", vbOKCancel)

Adodc1.RecordSource = ("SELECT * FROM letter_history WHERE letter_type = " & LetterType)
Adodc1.Refresh

End Sub
 
"No value given for one or more required parameters"
Usually means that you have misspelled some of your table/column names - check the spelling.

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Hi,

If letter_type is a text-field (non-numeric), you should add some quotes like this :

Adodc1.RecordSource = ("SELECT * FROM letter_history WHERE letter_type = '" & LetterType & "'")

Greetz,
Jan If this response was usefull to you, please mark it with a Star!
 
You might to try enclosing the LetterType in single quotes.

Adodc1.RecordSource = ("SELECT * FROM letter_history WHERE letter_type = '" & LetterType & "'") Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I thought i had tried the single quote thing before but obviously not as it works now, thanks everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top