Search form additional functionality

west

Registered User.
Local time
Today, 13:06
Joined
Feb 11, 2010
Messages
25
I'm using Allen Browne's search form in an application for demographic purposes.

The form is working fine, but the user is asking for a new functionality. He wants at lease 3 state combo boxes so he can filter that [State] field for at lease three choices and the way it is build now he can only have one. I tried the following code (with the corresponding text boxes in the form), but it didn't, the result was no search at all.

Code:
If Not IsNull(Me.txtState01) Then
   strWhere = strWhere & "([State] Like ""*" & Me.txtState01 & "*"") AND "
End If

If Not IsNull(Me.txtState02) Then
   strWhere = strWhere & "([State] Like ""*" & Me.txtState02 & "*"") AND "
End If

If Not IsNull(Me.txtState03) Then
   strWhere = strWhere & "([State] Like ""*" & Me.txtState03 & "*"") AND "
End If
In the Allen Browne's documentation he explains about using the AND and OR's and I tried a few combinations, but the result this time was no record found at all.

Any ideas?

-West
 
depending on other possible search boxes.... you may need to tinker with this some more but... for just these three just replace all the AND by OR and it should work... assuming you just want to match all 3 states
 
Given what you're doing, you'd want OR between those 3. If there are other criteria, you'd likely have to put parentheses around this group to avoid AND/OR confusion.
 

Users who are viewing this thread

Back
Top Bottom