M
Melissa
I am using the search criteria form created by Allen Browne.
Is there a way to enter multiple values in one search filter? For example,
State is a search value. I'd like the filter to return results for CA and CO.
As it is today, I can only search CA or CO.
Here is the code I am using to run the filter, compliments of Allen Browne.
Private Sub cmdFilter_Click()
If Not IsNull(Me.txtFilterRegion) Then
strWhere = strWhere & "([Region] = """ & Me.txtFilterRegion & """)
AND "
End If
If Not IsNull(Me.txtFilterState) Then
strWhere = strWhere & "([MarketState] = """ & Me.txtFilterState &
""") AND "
End If
If Not IsNull(Me.TxtFilterCategory) Then
strWhere = strWhere & "([Category] = """ & Me.TxtFilterCategory &
""") AND "
End If
If Not IsNull(Me.txtFilterShipTo) Then
strWhere = strWhere & "([Ship To] Like ""*" & Me.txtFilterShipTo &
"*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Is there a way to enter multiple values in one search filter? For example,
State is a search value. I'd like the filter to return results for CA and CO.
As it is today, I can only search CA or CO.
Here is the code I am using to run the filter, compliments of Allen Browne.
Private Sub cmdFilter_Click()
If Not IsNull(Me.txtFilterRegion) Then
strWhere = strWhere & "([Region] = """ & Me.txtFilterRegion & """)
AND "
End If
If Not IsNull(Me.txtFilterState) Then
strWhere = strWhere & "([MarketState] = """ & Me.txtFilterState &
""") AND "
End If
If Not IsNull(Me.TxtFilterCategory) Then
strWhere = strWhere & "([Category] = """ & Me.TxtFilterCategory &
""") AND "
End If
If Not IsNull(Me.txtFilterShipTo) Then
strWhere = strWhere & "([Ship To] Like ""*" & Me.txtFilterShipTo &
"*"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub