Returning data where 2nd criteria is left blank

C

craftprincess

I have created a parameter query where I enter the category I am looking for
and then a sub category. This works fine, but what I would also like to
happen is that if no sub category is entered the results show all items in
the category. Currently if I enter no sub category in the parameter query I
get no results returned. Is there a way to do this please?
 
R

Rick Brandt

craftprincess said:
I have created a parameter query where I enter the category I am looking for
and then a sub category. This works fine, but what I would also like to
happen is that if no sub category is entered the results show all items in
the category. Currently if I enter no sub category in the parameter query I
get no results returned. Is there a way to do this please?

SELECT * FROM SomeTable
WHERE SomeField = [First Parameter]
AND (SomeOtherField = [Second Parameter] OR [Second Parameter] Is Null)
 
Top