if form open criteria is blank, I do not want a new record to open

G

ghetto_banjo

I have a form where a user can type in a value in a textbox, click a
button, and the corresponding record opens up in a different form. I
do this using the criteria in the docmd.openform command like this:

formname = "frmClaim"

criteria = "[Hawb]= '" & Me![txtHawb] & "'"

DoCmd.OpenForm formname, , , criteria, acFormEdit


This works fine (after i figured out the syntax for the criteria being
based on a text field! ). However, if the criteria is not found, I
want a message box to open up saying this "Record could not be found"
as opposed to the form opening up with a new blank record.

Any ideas on how to achieve this?

Thank you gurus!
 
G

ghetto_banjo

The DCount method worked like a charm!! Thanks a lot, I never knew
that little trick.
 

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