Using wildcards in queries

  • Thread starter Thread starter Rob NYS
  • Start date Start date
R

Rob NYS

I have a combo box that includes a list of names and union with "all".
I want the combo box to be able to select records by name in the list
or include all names. I tried the following in the criteria section of
the underlying query.

IIf([Forms]![rReportSelector]![Name]="all",Like
"*",[Forms]![rReportSelector]![Name])

and

IIf([Forms]![rReportSelector]![TCASelect]="all",Is
Null,[Forms]![rReportSelector]![TCASelect])

and

IIf([Forms]![rReportSelector]![TCASelect]="all",Like "
",[Forms]![rReportSelector]![TCASelect])

and

IIf([Forms]![rReportSelector]![TCASelect]="all","
",[Forms]![rReportSelector]![TCASelect])

If I select a name, it works correctly, I only get records associated
with that name, however, "all" does not work. I don't get any records.
I went as far as having two different queries (one to select all
records, and second to select specific records based on name). In the
open event of the report I wrote an If statement to change the
Me.Recordsource based on user selection, also with no luck.

Please help.

Thank You.
 
I have a combo box that includes a list of names and union with "all".
I want the combo box to be able to select records by name in the list
or include all names. I tried the following in the criteria section of
the underlying query.

IIf([Forms]![rReportSelector]![Name]="all",Like
"*",[Forms]![rReportSelector]![Name])

and

IIf([Forms]![rReportSelector]![TCASelect]="all",Is
Null,[Forms]![rReportSelector]![TCASelect])

and

IIf([Forms]![rReportSelector]![TCASelect]="all",Like "
",[Forms]![rReportSelector]![TCASelect])

and

IIf([Forms]![rReportSelector]![TCASelect]="all","
",[Forms]![rReportSelector]![TCASelect])

If I select a name, it works correctly, I only get records associated
with that name, however, "all" does not work. I don't get any records.
I went as far as having two different queries (one to select all
records, and second to select specific records based on name). In the
open event of the report I wrote an If statement to change the
Me.Recordsource based on user selection, also with no luck.

Please help.

Thank You.

Like IIf([Forms]![rReportSelector]![Name]= "all", "*",
[Forms]![rReportSelector]![Name])
 
Back
Top