Filters that find no records

  • Thread starter Thread starter Nick.Korynski
  • Start date Start date
N

Nick.Korynski

I am using the openform command to open a form based on user data that
is inputted. It works great when the data entered matches something in
my table, but when no data exists a pop up box appears asking for the
user to enter data. Is there anyway to detect when no records are
returned so that I can display a message box or something letting the
user know that no records were found? Thanks.

Nick
 
Works great. Thanks!
You could do a DLookup to see if the data exists before opening the form.
Since I don't know your form, table, or field names, this will be an example
you will have to change the names in to make it work for you:

If IsNull(DLookup("[CustID]", "tblCustomer", "[CustID] = " &
Me.txtCustID)) Then
MsgBox Me.txtCustID & " Not Found"
Else
Docmd.OpenForm "frmCustomer", , , "[CustID] = " & Me.txtCustID
End If

--
Dave Hargis, Microsoft Access MVP


I am using the openform command to open a form based on user data that
is inputted. It works great when the data entered matches something in
my table, but when no data exists a pop up box appears asking for the
user to enter data. Is there anyway to detect when no records are
returned so that I can display a message box or something letting the
user know that no records were found? Thanks.

Nick
 

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

Back
Top