Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF statement, criteria, nulls

Status
Not open for further replies.

Fonzie

MIS
Feb 16, 2001
74
CA
The criteria in my query references some fields on a search form. What I need it to do is if Text24 is null, select all values from the table including null value fields. If Text24 is not null, select the records where FieldA = Text24. I tried to use an IIF statement, but I would either get no records returned or an error. This is the IIF statement I was using:

IIf(IsNull([forms]![searchmenu]![text24]),Like "*" & [forms]![searchmenu]![text24] & "*" Or Is Null,[forms]![searchmenu]![text24])

Any suggestions? It's important that the records with null values ONLY be included when Text24 on the search form is null.
 
=[forms]![searchmenu]![text24] OR [forms]![searchmenu]![text24] Is Null

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You know I seen you posted that code in a different thread and I tried it before with no results. Sure as heck, works like a charm this time. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top