sql query

orelv4

Registered User.
Local time
Today, 10:34
Joined
Apr 15, 2010
Messages
32
hi ,
I have a sql in my code and it doesnt work...
does enyone see any problem with my sql?
strSQL = "SELECT prog_ID FROM Program WHERE Address = ' " & iaddress & " ' "

iaddress is a variable
thanks!!!
 
What's the rest of the code that is using it. When you say "it doesn't work" what do you mean? Does it give an error, does it do anything? How are you using strSQL? Are you opening it with a Recordset, a DLookup, What?
 
Yes lots of missing info and conjecture...

But geuswork...
' " & iaddress & " ' "
Note the extra spaces there....
Try:
'" & iaddress & "'"
 
you right!!!
just the spaces.
thanks!!!!... :)
 
FYI. The closing semicolon is NOT required
Good point. That crossed my mind too as I don't ever use it in my code (it might exist in someone elses and I just leave it there when editing, but I don't include it myself).
 

Users who are viewing this thread

Back
Top Bottom