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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignoring Null Fields In Form When Running Query

Status
Not open for further replies.

stevefutcher

Technical User
Oct 31, 2007
13
0
0
GB
I am trying to write a query that searches a table with address data based on criteria input using a form.

The trouble is that if the field in the form is null the criteria in the query is "Is Null".

I want to return all values for a field if the form in the form is null, i.e. the equivalent of entering no criteria in the query.

I have tried IIF(IsNull([AddressTable]![Fieldname])=True,"",[AddressTable]![Fieldname]) but this doesn't seem to work.

Any ideas?
 
It would probably be best to build the SQL string programmatically. This can then be used with a new or an existing query.
 
In the criteria cell:
=[FORMS]![main form]![text box] OR [FORMS]![main form]![text box] Is Null

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top