S
shmoussa
I'm not sure how to do the following. I have a single-selection
listbox. When I select a certain option and click a command button, I
want pre-specified multiple criteria to be used to generate a query.
Example: If I select "Light colors" from my listbox, and then click a
command button I want a query to generate using "blue OR yellow" as
the criteria. If I select "dark colors" from the listbox and click the
command box, the query should generate using "brown OR black" as the
criteria.
The idea (and I know this is completely wrong, however I brandnew to
VB, this is just so you get the idea)
If listbox.ItemsSelected="Light Colors" Then
strSQL = "SELECT Colors, Price " & _
"FROM [Clothing] " & _
"WHERE Colors="blue OR yellow""
Else If
If listbox.ItemsSelected="DarkColors" Then
strSQL = "SELECT Colors, Price " & _
"FROM [Clothing] " & _
"WHERE Colors="brown OR black""
Once again, I know this code is wrong- but this is idea I am going
for. Please let me know if and how this could be done.
listbox. When I select a certain option and click a command button, I
want pre-specified multiple criteria to be used to generate a query.
Example: If I select "Light colors" from my listbox, and then click a
command button I want a query to generate using "blue OR yellow" as
the criteria. If I select "dark colors" from the listbox and click the
command box, the query should generate using "brown OR black" as the
criteria.
The idea (and I know this is completely wrong, however I brandnew to
VB, this is just so you get the idea)
If listbox.ItemsSelected="Light Colors" Then
strSQL = "SELECT Colors, Price " & _
"FROM [Clothing] " & _
"WHERE Colors="blue OR yellow""
Else If
If listbox.ItemsSelected="DarkColors" Then
strSQL = "SELECT Colors, Price " & _
"FROM [Clothing] " & _
"WHERE Colors="brown OR black""
Once again, I know this code is wrong- but this is idea I am going
for. Please let me know if and how this could be done.