So I am trying to write a sql string in vba access 2010 that uses two numeric variables in the "where" clause. If I use one variable my code works perfect. Two variables and my syntax is broken. Here is what it looks like for 1 variable (this works):
stringSQL = "select table1.field1, table2.field2 from table1 where table1.flag='flag' and
table1.weight = " & [Forms]![myform]![weight]
This is what i used for two variables (age and weight) - this is where i need help in the syntax:
stringSQL = "select table1.field1, table2.field2 from table1 where table1.flag='flag' and
table1.age= " & [Forms]![myform]![age] & " and " & table1.weight= " &
[Forms]![myform]![weight]
so it basically boils down to the parentheses and ampersand in the last statement. any ideas?
stringSQL = "select table1.field1, table2.field2 from table1 where table1.flag='flag' and
table1.weight = " & [Forms]![myform]![weight]
This is what i used for two variables (age and weight) - this is where i need help in the syntax:
stringSQL = "select table1.field1, table2.field2 from table1 where table1.flag='flag' and
table1.age= " & [Forms]![myform]![age] & " and " & table1.weight= " &
[Forms]![myform]![weight]
so it basically boils down to the parentheses and ampersand in the last statement. any ideas?