-
I have a sql statement where i pass a variable instead of passing the value directly. for ex:
strQuery = ("Select * from tablename" _
& " where [Company Name]= " & "'" + Trim(variablename) + "'")
when I pass ABC as variable value its working fine. But when I pass ABC's as the value it is giving me a error.
any help might help.
thankyou.
-
Hi,
Try replacing the single quote with two single quotes side by side:
Abc's --> Abc''s
HTH,
Preeti
-
I tryed doing that it doesnt do any good.
-
Hi,
Okay, this might get confusing:
You have to surround the whole string in double quotes and then place physically place a single quote. And the quotes need to be treated as strings and not string delimiters:
"VALUES(""ABC" & "'" & "S"")"
The first two double quotes places one double quote before the ABS as a string, then the & "'" & adds the single quote as a string, then the "S"", places a double quote after the S still as part of the string.
HTH,
Preeti