Wildcard in a query?

tcshred

Registered User.
Local time
Today, 11:01
Joined
Sep 17, 2013
Messages
13
I am trying to use the wildcard in a query and failing miserably.

I have two combo boxes on a form. One contains the months, and the other the department.

I want to make it so that you select the month from the combo box, and if the second combo box is left blank, all records(for that month) are returned. If the second combo box is used, then the query will also filter for that department and the date selected.

The first one is working fine, here is what I am using for the second with no success:

in the criteria:
=iif(isnull([forms]![ReportingFrm]![combo2]),Like "*",[forms]![ReportingFrm]![combo2])

No records are returned. I have also tried using "*" as a default value, entering * into a table ect with no success.

Suggestions?
 
Last edited:
Forms!reportfrm!combo2 or forms!reportfrm!combo2 is null

Another approach is

Like "*" forms!reportfrm!comb2 "*"

But this should only be used if partial field searches is required


Brian
 
I tried =iif(forms!reportfrm!combo2 is null,like "*",forms!reportfrm!combo2). Is this different?
 
I tried =iif(forms!reportfrm!combo2 is null,like "*",forms!reportfrm!combo2). Is this different?
Nope you cannot use LIKE operator like that.. As Brian suggested, use..
Code:
Forms!reportfrm!combo2 or forms!reportfrm!combo2 is null
in the criteria..
 

Users who are viewing this thread

Back
Top Bottom