Why are you doing this on a form anyway? These records are not editable.
What specifically do you not understand? The potential limitation on filter string length? How to modify Browne's function? How to use Yes/No field to tag records for filtering? How to write code to set the Yes/No field? How to modify Query1 to show all records from MainTable?
I did get this to work.
Code:
' Build criteria string from selected items in list box.
If Me.cboStates.ItemsSelected.Count > 0 Then
If strWhere <> "" Then strWhere = strWhere & "("
For Each i In Me.cboStates.ItemsSelected
If Criteria <> "" Then
Criteria = Criteria & " OR "
End If
Criteria = Criteria & "Statess LIKE '*" & Me.cboStates.ItemData(i) & "*'"
Next i
strWhere = strWhere & Criteria & IIf(InStr(strWhere, " AND ") > 0, ")", "") & " AND "
End If
I removed the two lines following the listbox code that apply the Criteria string to filter.