Avatar of Fritz Paul
Fritz Paul
Flag for South Africa asked on

Help with wildcard in query please.

I use Access 2010.
I have a combobox [Filter_Location] on a form [frm_Planting] and I want to use the value of the combobox in a query criteria. If the combobox is empty, I want all the values in the source. Otherwise I want only the values specified by the combobox.
I use the following criterium, but the problem is if the value of the combobox is 3, the query also give me values for 13, 23 etc.
Like "*" & [Forms]![frm_Planting]![Filter_Location]
Microsoft Access

Avatar of undefined
Last Comment
Fritz Paul

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rgonzo1971

or
 Like Iif([Forms]![frm_Planting]![Filter_Location]="","*",[Forms]![frm_Planting]![Filter_Location])

Open in new window

Fritz Paul

ASKER
Thanks, but if [Forms]![frm_Planting]![Filter_Location]="", then it return no records, otherwise it works correctly.
Rgonzo1971

Have you tried my 2nd solution
Your help has saved me hundreds of hours of internet surfing.
fblack61
Fritz Paul

ASKER
Thanks, I did not notice your first solution.
Like nz([Forms]![frm_Planting]![Filter_Location], "*")
This works thanks!