I use ADO to run the SQL in excel .
The SQL is
sSQLSting = "SELECT officer ,sum(mkt) from [$DB] where month=2 group by officer"
In my system , there is a combobox that consist of the options of YES & NO.
For Yes , the SQL where statement would become where month=3
For No , the SQL where statement would become where month=4
In my plan , I want to Dim an integer variable to store month in VBA.Then , variable -month gets the combobox result so that 3 will be stored into month.
Lastly , the integer variable-month can pass to the SQL statement ***
sSQLSting = "SELECT officer ,sum(mkt) from [$DB] where month=***group by officer
This is my plan . Is it possible to catch the combobox result and pass the value to SQL statement ?