Blank Parameter Query

J

John Pierce

When I only want to chosse one criteria in a parameter query it works well,
but somtimes I would like to leave the Parameter Query blank so I can see
all the data rather than filter it? Is that possible.

Other times I might like to see two of the possible four criteria. Is there
a way to do that?

Thanks,
John Pierce
 
G

Guest

John:

To optionalize a parameter test for the it being OR IS NULL. Put each OR
operation in parentheses to make them evaluate independently of the AND
operations e.g.

SELECT *
FROM MyTable
WHERE
(Field1 = [Enter value 1:] OR [Enter value 1:] IS NULL)
AND
(Field2 = [Enter value 2:] OR [Enter value 2:] IS NULL)
AND
(Field3 = [Enter value 3:] OR [Enter value 3:] IS NULL)
AND
(Field4 = [Enter value 4:] OR [Enter value 4:] IS NULL);

To do it in query design view you would enter:

[Enter value 1:] OR [Enter value 1:] IS NULL

in the criteria row of Field1, and similarly for the other fields. If you
then save the query and reopen it in design view you'll find Access has
shifted things around. The underlying logic will still be the same, however,
and it will operate in exactly the same way.

Ken Sheridan
Stafford, England
 
D

Duane Hookom

Don't use a parameter prompt in queries. Use a form that provides much more
flexibility and functionality. You can then use a multi-select list box and
many other features.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top