Wildcards

G

GLock

Hello,

I am trying to use a wildcard in a query and have run into a roadblock. I
am using a combo box to pass criteria to a query using the following IF
statement. However, if the user selects "All" in the combo box, I want the
query to open up and return all records. The "Like *" doesn't seem to be
the right way to do it. Please help!

IIf([forms]![sfrmDD_New_add]![cbodoc_grp_avail]="All",Like ""*"
",[forms]![sfrmDD_New_add]![cbodoc_grp_avail])
 
F

Fredg

GLock said:
Hello,

I am trying to use a wildcard in a query and have run into a roadblock. I
am using a combo box to pass criteria to a query using the following IF
statement. However, if the user selects "All" in the combo box, I want the
query to open up and return all records. The "Like *" doesn't seem to be
the right way to do it. Please help!

IIf([forms]![sfrmDD_New_add]![cbodoc_grp_avail]="All",Like ""*"
",[forms]![sfrmDD_New_add]![cbodoc_grp_avail])

Try it this way:
Like IIf([forms]![sfrmDD_New_add]![cbodoc_grp_avail]="All","*",
[forms]![sfrmDD_New_add]![cbodoc_grp_avail])
 
G

GLock

Thanks Fred, you're the man!!

I can't tell you how many variations I tried....but not that one!

Fredg said:
GLock said:
Hello,

I am trying to use a wildcard in a query and have run into a roadblock. I
am using a combo box to pass criteria to a query using the following IF
statement. However, if the user selects "All" in the combo box, I want the
query to open up and return all records. The "Like *" doesn't seem to be
the right way to do it. Please help!

IIf([forms]![sfrmDD_New_add]![cbodoc_grp_avail]="All",Like ""*"
",[forms]![sfrmDD_New_add]![cbodoc_grp_avail])

Try it this way:
Like IIf([forms]![sfrmDD_New_add]![cbodoc_grp_avail]="All","*",
[forms]![sfrmDD_New_add]![cbodoc_grp_avail])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top