How to use variable in sql string

  • Thread starter Thread starter Nova
  • Start date Start date
N

Nova

Hi
In my form has two textbox Tb1 and Tb2, 1 Variable V1 and V1=Tb1+Tb2.
In my sql string

Sqlstr="SELECT A,B,C FROM Table1 WHERE C=V1"

It does not work. How can I correct this problem?

Thanks
 
On Wed, 30 Sep 2009 20:13:01 -0700, Nova

Sqlstr="SELECT A,B,C FROM Table1 WHERE C=" & V1
or, if V1 is text rather than a number:
Sqlstr="SELECT A,B,C FROM Table1 WHERE C='" & V1 & "'"

-Tom.
Microsoft Access MVP
 
Back
Top