Hi all, I have a form that filters a query. From that form there are multipe listboxes.
At the moment, in my query, I filter the results using the following in the query criterea
i.e.
[forms]![search]![cboarea]
etc. etc.
However, I would now like to add amultiple selection list box, instead of one of the combo boxes. After scanning around on the web it has become apparent that you can not simply use a list box using the above form criterea. I have found a couple of examples:
But this does not seem to work for me. Bear in mind, that as well as selecting information from the list box, I still need to include the criterea from my other combo boxes.
http://support.microsoft.com/kb/135546 seems to be the most thourgh explanation out there, but I must admit I am a bit stuck.
Any help you can provide would be hugely appreciated. Many thanks
At the moment, in my query, I filter the results using the following in the query criterea
i.e.
[forms]![search]![cboarea]
etc. etc.
However, I would now like to add amultiple selection list box, instead of one of the combo boxes. After scanning around on the web it has become apparent that you can not simply use a list box using the above form criterea. I have found a couple of examples:
Code:
Option Compare Database
Option Explicit
Private Sub Command2_Click()
Dim Criteria As String
Dim i As Variant
' Build criteria string from selected items in list box.
Criteria = ""
For Each i In Me![List0].ItemsSelected
If Criteria <> "" Then
Criteria = Criteria & " OR "
End If
Criteria = Criteria & "[CustomerId]='" _
& Me![List0].ItemData(i) & "'"
Next i
' Filter the form using selected items in the list box.
Me.Filter = Criteria
Me.FilterOn = True
End Sub
But this does not seem to work for me. Bear in mind, that as well as selecting information from the list box, I still need to include the criterea from my other combo boxes.
http://support.microsoft.com/kb/135546 seems to be the most thourgh explanation out there, but I must admit I am a bit stuck.
Any help you can provide would be hugely appreciated. Many thanks