Query Criteria with a wilcard (1 Viewer)

RevJeff

Registered User.
Local time
Today, 13:12
Joined
Sep 18, 2002
Messages
125
Hello,

I am trying to setup a query that looks at a ComboBox named "Location". If "All" is selected in the ComboBox, I want everything displayed in the query, but if a certain location is selected, then the query only displays that locations information. That part works fine. It's that "All" part that I am having issues with. Below is the code I have in the Criteria field in the query.

Code:
IIf([Forms]![frmDashboard]![Location]="All",Like "*",[Forms]![frmDashboard]![Location])

Thanks for your help.
 

Minty

AWF VIP
Local time
Today, 17:12
Joined
Jul 26, 2013
Messages
10,355
You don't need the "All" , have it default to Null value, then in the criteria put the following

Code:
=[Forms]![frmDashboard]![Location] Or [Forms]![frmDashboard]![Location] Is Null

This will bring back all values if the combo is null, and can be repeated for multiple combo's.
 

RevJeff

Registered User.
Local time
Today, 13:12
Joined
Sep 18, 2002
Messages
125
That works perfectly! Thank you!
 

Users who are viewing this thread

Top Bottom