How do I stop the opening of a Blank Form in Access 2000?

W

Will Hunt

I have a query which I have added Criteria to what data is presented when it
opens. Example... I am lookin g for John Smith in a particular field. John
Smith does not exist in the query. I have a Form attached to this query... I
want to stop the form from being opened if someone searches for John Smith...
or any other name that does not exist in the query.
 
A

Al Camp

Will,
Do a Dlookup against your table with the search value. If Null, then don't open the
form, and post a MsgBox to the user that that record doesn't exist.
If NOT IsNull then proceed normally

Better yet... If your user was presented with a combo box to select a name from... and
that combo was based on legitimate records in your table, then Not In List could be used
to trigger the Open/NotOpen. Given a combo of Name and NameID, you can search for the
record by the key field NameID rather than just the name. (duplicate names will cause
problems)
 

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