B
Brian
Hello. I am trying to build an SQL statement in access.
I want it to substitute a value typed into a text box
into the SQL statement. Part of my code reads:
strqry = strqry & "((ACCOUNT_LIST.COMPLEMENTOR)=" &
txtCOMP & ") AND "
all on one line of course.
txtCOMP is the value that I want to show up in the actual
SQL code. Lets say that txtCOMP = asdf. I want the
actuall SQL code to read:
((ACCOUNT_LIST.COMPLEMENTOR)="asdf") AND
My problem is that I am not sure how to get the qoutes
around asdf to show up in the SQL code. I have no
problem getting it not to show up, though:
((ACCOUNT_LIST.COMPLEMENTOR)=asdf) AND
But as far as I know, I need the quotes for the statement
to work correctly.
Is there an escape character or something that allows me
to use the quotes without the VBA complier complaining
about a syntax error?
Because this:
strqry = strqry & "((ACCOUNT_LIST.COMPLEMENTOR)="" &
txtCOMP & "") AND "
does not work.
Thanks for any help. If I need to clarify anything,
please let me know.
I want it to substitute a value typed into a text box
into the SQL statement. Part of my code reads:
strqry = strqry & "((ACCOUNT_LIST.COMPLEMENTOR)=" &
txtCOMP & ") AND "
all on one line of course.
txtCOMP is the value that I want to show up in the actual
SQL code. Lets say that txtCOMP = asdf. I want the
actuall SQL code to read:
((ACCOUNT_LIST.COMPLEMENTOR)="asdf") AND
My problem is that I am not sure how to get the qoutes
around asdf to show up in the SQL code. I have no
problem getting it not to show up, though:
((ACCOUNT_LIST.COMPLEMENTOR)=asdf) AND
But as far as I know, I need the quotes for the statement
to work correctly.
Is there an escape character or something that allows me
to use the quotes without the VBA complier complaining
about a syntax error?
Because this:
strqry = strqry & "((ACCOUNT_LIST.COMPLEMENTOR)="" &
txtCOMP & "") AND "
does not work.
Thanks for any help. If I need to clarify anything,
please let me know.