[RESOLVED] Correct my SQL stt (wait, trying to see in FAQs)
Can anyone help me correct syntax error(s) in the following code:
Quote:
MyRSDetails.Open "SELECT tblClients.ClientCode, tblClients.* FROM tblClients" & _
"WHERE tblClients.ClientCode = '" & strClientID & "';", conn, adOpenKeyset, adLockOptimistic
Runtime error : Syntax error in FROM clause.
Thank u
Re: Correct my SQL stt (wait, trying to see in FAQs)
Code:
MyRSDetails.Open "SELECT * FROM tblClients" & _
" WHERE tblClients.ClientCode = '" & strClientID & "'", conn, adOpenKeyset, adLockOptimistic
Re: Correct my SQL stt (wait, trying to see in FAQs)
Yeah - you need a space after the table name.
Best thing is to put the sql statement into a string variable then you can debug.print it (or breakpoint n check it).
Re: Correct my SQL stt (wait, trying to see in FAQs)
You need a space between tblClients and WHERE.
The semicolon is ok but not needed.
If ClientCode is a numeric field, you'll need to use a numeric variable, not a string.