Who knows the solution to following?
I have a form and I have two listboxes on it.
The first one is called "possible selections customer types", and contains "A - Best", "B - Good" and "C - Worse".
The second one is called "selected customer types", and is filled with with the selections made in listbox one.
What I would like to do is that the users are able to choose "A", "A"& "B", "A"&"c", "B"&"C", B or C as values and add them to the 2nd selection list.
Now... I know how to get these two lists and know how to get the values from lsit one to list two using selection command buttons, but:
How on eart can I use the selected values in a sql query in VBA?
I tried to do following:
Dim rst as DAO Recordset
Dim StrSQl as String
Dim Db as Database
Dim WSelection
DimWrSetOpen as boolean
Select SelectedItems
Case "A - Best"
wSelection = "A"
Case "B"
wSelection = "B - Good"
Case C
wSelection = "C - Poor"
StrSql = Select [Customer] from tblOrders Where (([Customernumber]="1"
And ([Customertype] = WSelection ))
Set Rst = Db.OpenRecordset(StrSql)
WrSetopen = True
' Now I have a recorset I could work with... BUT:
The problem is it won't work!!!
Please need some Help!
Any other help with this kind of nulti-selection "problems" are welcome as well....
Many thanks in Advance!
Ramon
I have a form and I have two listboxes on it.
The first one is called "possible selections customer types", and contains "A - Best", "B - Good" and "C - Worse".
The second one is called "selected customer types", and is filled with with the selections made in listbox one.
What I would like to do is that the users are able to choose "A", "A"& "B", "A"&"c", "B"&"C", B or C as values and add them to the 2nd selection list.
Now... I know how to get these two lists and know how to get the values from lsit one to list two using selection command buttons, but:
How on eart can I use the selected values in a sql query in VBA?
I tried to do following:
Dim rst as DAO Recordset
Dim StrSQl as String
Dim Db as Database
Dim WSelection
DimWrSetOpen as boolean
Select SelectedItems
Case "A - Best"
wSelection = "A"
Case "B"
wSelection = "B - Good"
Case C
wSelection = "C - Poor"
StrSql = Select [Customer] from tblOrders Where (([Customernumber]="1"
Set Rst = Db.OpenRecordset(StrSql)
WrSetopen = True
' Now I have a recorset I could work with... BUT:
The problem is it won't work!!!
Please need some Help!
Any other help with this kind of nulti-selection "problems" are welcome as well....
Many thanks in Advance!
Ramon