Hello, I have a question about making multiple selection queries in Access. I am running windows XP and Access 2003. Up until this point I had a form where a user would make single selections from a combo box and the following combo box would filter based on the initial selection. I now would like to give the opportunity to make multiple selections and the following combo box would filter based on that. How do I go about declaring this variable and passing the selections onto the next column?
Thank you,
__1. You cannot make multiple selections from a Combo Box - you must use a List Box.
__2. I'll assume that it is a single column List Box, and that you want to make multiple selections from choices made within it.
__3. For demo purposes, we'll name the List Box lstTest.
__4. Set the Multi Select Property of the List Box to Extended. This will enable you to use both CTRL and SHIFT in your selections.
__5. To retrieve all Selected Items from lstTest and build your Criteria String:
- Dim ctl As Control, varItm As Variant
-
-
Set ctl = Me![lstTest]
-
-
For Each varItm In ctl.ItemsSelected
-
Debug.Print ctl.ItemData(varItm)
-
Next varItm