I am using Access 2007 and have a user form that contains a text box
that is used as a filter for a Query. The form also contains a button
that is used to open the query. The goal is for the user to be able to
leave the field blank and have the query pull ALL the data, or enter
in filter criteria and have the query filter the data. Here is what I
have written and places in the Criteria Line in the query:

IIf(IsNull([Forms]![DLG_Report]![Country]),Like "*",[Forms]!
[DLG_Report]![Country]),

Note:
[DLG_Report] = Form with text box user enters data
[Country] = Text Box Field

This does not produce any results. If I remove the "*" and type in
"Australia" and run the query with the empty field, data with
"Australia" in the field pulls up. If I remove the IIF statement and
just enter Like "*", all the data pulls up. But, when I include the
IIF statement with the "*" statement, no data is pulled. Any ideas?

Reply via email to