I currently have a form whose header allows users to select criteria from two unbound combo boxes (with record source based on a table/query) and run a filter command which populates the detail section with a list based on the selected criteria. I would like to have users be able to select multiple values from each combo box.
I have tried using a list box instead of a combo box, but I'm missing something - when I run the filter command I get a message that says "No Criteria." It seems like although I am selecting multiple values I am missing a step.
My Filter Command, if relevant, is as follows:
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboFilterLocalNumber) Then
strWhere = strWhere & "([Local#] = """ & Me.cboFilterLocalNumber & """) And "
End If
If Not IsNull(Me.cboFilterPartyAffiliation) Then
strWhere = strWhere & "([PartyAffiliation] = """ & Me.cboFilterPartyAffiliation & """) And """
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
I have tried using a list box instead of a combo box, but I'm missing something - when I run the filter command I get a message that says "No Criteria." It seems like although I am selecting multiple values I am missing a step.
My Filter Command, if relevant, is as follows:
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboFilterLocalNumber) Then
strWhere = strWhere & "([Local#] = """ & Me.cboFilterLocalNumber & """) And "
End If
If Not IsNull(Me.cboFilterPartyAffiliation) Then
strWhere = strWhere & "([PartyAffiliation] = """ & Me.cboFilterPartyAffiliation & """) And """
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub