Use criteria or return all records

Cosmos75

Registered User.
Local time
Today, 10:42
Joined
Apr 22, 2002
Messages
1,280
I have this for a query.

SELECT [Field1], [Field2]
FROM [Table1]
WHERE [Field1]=NZ([SearchThis],[Field1]);


I want to return all records if [SearchThis] is not entered. If [SearchThis] is entered, then use [SearchThis] as criteria.

It returns all records where [Field1] <> Null but I also want to return records that are Null (i.e. return all records).
 
In the criteria of the query design put:

[Forms]![MyForm]![MyControl] OR [Forms]![MyForm]![MyControl] Is Null

Once saved and reopened in design view the query will have fixed the correct structure for you.
 
Thanks, Mile-O-Phile!
 

Users who are viewing this thread

Back
Top Bottom