Wildcards

  • Thread starter Thread starter GLock
  • Start date Start date
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])
 
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])
 
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])
 
Back
Top