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

sql syntax parameter

Status
Not open for further replies.

matrixknow

IS-IT--Management
May 3, 2007
78
Hallo,

If I type the parameter for the where condition hard coded, it works.
Code:
& "WHERE ((([Tbl_HR Contacts].HRC_C)= ""C002""));"

Because there are a number of parameters I get this by a recordset and a string. He does not give an error but he give back 0 records, it should be for C002 = 5
I looked at the value of strCode with a message box.

Code:
Dim strCode As String
   strCode = rst!HRC


& "WHERE ((([Tbl_HR Contacts].HRC)= " & strCode & "));"
 
You need to wrap your string with quotes (single works for inner quotes):

[tt]"WHERE ((([Tbl_HR Contacts].HRC)= '" & strCode & "'));"[/tt]

HTH,
Larry
 
Code:
& "WHERE ((([Tbl_HR Contacts].HRC_C)='" & rst!HRC_C & "'));"

found !
 
thanks Larry,

I came to the same conclusion. I put my SQL in a msgbox and saw what he was writing. I took me a while .... dammed syntax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top