leave blank for all

K

ksimmsa

i trying to create a parameter query that give you the
option to input a particular name or leave blank to add
all of the names listed in that field.
 
T

Tonín

SELECT *
FROM YourTable
WHERE [YourField]=IIf([YourParameter] Is Not
Null,[YourParameter],[YourField]);

Regards,

Tonín
 
J

John Spencer (MVP)

Field: YourFieldName
Table: YourTableName
Criteria: [Input Name] or [Input Name] Is Null

Access will reformat the above when you save/close the query. It will still
work unless you have many criteria.

If YourFieldName is NEVER null/blank, then you can use criteria of

Criteria: LIKE NZ([Input Name],"*")

Which if you leave the parameter blank will return all records where
YourFieldName has a value.
 
Top