Multi-Select List Box as Query Parameter



Hello all,
Hoping someone can help me with list box multi selection problem.
I have been able to build a query that is filtered by a selection in a
List box, but now that I want to use a multi select list box so that two or
more items can be included in the query.

List box Name is: List42
List box source:TBL_Slocation
Form name: Receipts_Selection_Form

Below is my code which is not working
Private Sub List42_BeforeUpdate(Cancel As Integer)
Dim frm As Form
Dim ctl As Control
Dim varItem As Variant
Dim strSQL As String
Dim strWhere As String

Set frm = Forms!Receipts_Selection_Form
Set ctl = Me![List42]
strSQL = "Select * from TBL_SLocation"

For Each varItem In ctl.ItemsSelected
strWhere = strWhere & ctl.ItemData(varItem) & ", "
Next varItem
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question