• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 39
  • Last Modified:

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]
0
Fritz Paul
Asked:
Fritz Paul
  • 3
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try
Like nz([Forms]![frm_Planting]![Filter_Location], "*")

Open in new window

Regards
0
 
Rgonzo1971Commented:
or
 Like Iif([Forms]![frm_Planting]![Filter_Location]="","*",[Forms]![frm_Planting]![Filter_Location])

Open in new window

0
 
Fritz PaulAuthor Commented:
Thanks, but if [Forms]![frm_Planting]![Filter_Location]="", then it return no records, otherwise it works correctly.
0
 
Rgonzo1971Commented:
Have you tried my 2nd solution
0
 
Fritz PaulAuthor Commented:
Thanks, I did not notice your first solution.
Like nz([Forms]![frm_Planting]![Filter_Location], "*")
This works thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now