David said:
I have a query set up with [enter name] as my criteria so
the user can input the criteria. How can I (in addition
to this input criteria, have the query include all
records if value is NULL because the user just hit
ENTER? Thank you for the assistance.
Hi David,
In addition to Allen's sage advise,
some use the following work around:
SELECT ...
FROM ...
WHERE ([somefield]=[enter name])
OR ([enter name] IS NULL);
This works well "for now" but...
- this technique breaks down when you
have "many" parameters because
Access can "rewrite your OR's" and
you can end up with an unexpected WHERE
clause losing your original logic.
- "pulling parameters from a form" will allow
you to test & verify what the user enters and
give meaningful feedback to your users.
(I don't mean the technique of substituting
"Forms!frmA!txtA" for [enter name] in
your Criteria line --
I mean what Allen has covered briefly)
Some good examples can be found here:
http://www.rogersaccesslibrary.com/
and a powerful example within that site
is Duane's DH Query By Form
(not an example I think you want to
start with though):
http://www.rogersaccesslibrary.com/Otherdownload.asp?SampleName='DH Query By Fo
rm'
Please respond back if I have misunderstood.
Good luck,
Gary Walter