If..Then without Else

ScribeGuy

Registered User.
Local time
Today, 22:26
Joined
Mar 30, 2010
Messages
15
Hi everyone, I have searched and searched forums but so far have found nothing on this problem:

I have a search query that filters the search based on several fields from a form. The user chooses from combo boxes and whatever they choose goes in the query. The problem comes if the user chooses "All" in which case I don't want any criteria in the query (so as to show all results).

So I think I need an If...Then

If Forms!MyForm!MyField <> "Any" then Forms!MyForm!MyField

But it seems you can only use an "IIf" (not "If") statement in an expression, which requires a "DoIfFalse" argument. I don't want the query to filter anything at all if the form's field = "All" (result is false)

I looked at using SQL in VB but apparently this doesn't work on Select queries?
 
Your Query Criteria will need to be in the form;
Code:
Like (IIf([Forms]![FRM_FormName]![ComboName]="All"),"*",[Forms]![FRM_FormName]![ComboName]))

Check the sample I posted in this Thread which operates in a similar manner.
 
Last edited:
Excellent. Thanks JBB.
 

Users who are viewing this thread

Back
Top Bottom