Multiple Filter Criteria

FranD

Registered User.
Local time
Today, 03:25
Joined
Feb 29, 2000
Messages
32
I have a Dialog Form which prompts users to select any filter(s) they want applied to a report. The two filters are based on the "City" filed and the "Status" field.

Users can chose not make no selection (print without a filter) or they can chose one of the two filters - or they can chose both filters.

The only option I can't get to work, is when the user selects both filters (and of course this is the one we need the most). I'm not getting any compile error - It just doesn't find any data.

This is how I identified the filter in code:

Dim strWhereCity_Status As String
strWhereCity_Status = "City = (Forms![frmDialogForm]!SelectCity)" & "Status = (Forms![frmDialogForm]!SelectStatus)"

What am I doing wrong! Please Help!!
 
There is a problem with your string formatting.

Try this instead:
strWhereCity_Status = "City = """ & Forms![frmDialogForm]!SelectCity & """ and Status = """ & Forms![frmDialogForm]!SelectStatus & """"

This is assuming that both of the criteria are strings. If they are numeric, remove "" on each side of the criteria.
 
THANK YOU BarkerD - it worked perfectly.

Eventually I'll get this VBA thing down....with help from people like you that is.

Thanks again
 

Users who are viewing this thread

Back
Top Bottom