Select statement in VBA

chris89

Registered User.
Local time
Today, 05:16
Joined
Nov 28, 2011
Messages
71
I m trying to write the following SQL statement in VBA:

Code:
SELECT ID,Product,Size FROM Products
Where Product ='A' AND Size = '1'

I want to use the values from combobox 1(cmb1) for 'A' and combobox 2(cmb2) for '1'

I know how to code it without the AND Operator like this:
Code:
"SELECT ID,Product,Size FROM" & _
                        " Products WHERE Product= " & _
                          Me.cmb1

How can I include the AND operator into VBA??

Thank you in advance
 
Try;
Code:
"SELECT ID,Product,Size FROM Products " & _
"Where Product = " &  Me.cmb1 & " AND Size = " &  Me.cmb2 & ";"

This link should help formulate further SQL statements in VBA
 
Thank you !!
This is exactly what I was looking for
 

Users who are viewing this thread

Back
Top Bottom