Creating a "record not found" message

H

hje

I have a form (called search) capturing user entered data,
which executes a query (called search_qry.) The results
are displayed using another form (called
search_qry_output).

Currently, if there is no match on the search, Access
displays a blacked out search_qry_output form.

What I would like to have it do, is display a text box
stating that no match was found, and return the user back
to the form called search.

Any suggestions for this?
 
S

Sal Rosario

I have done this:

Private Sub Form_Open(Cancel As Integer)
Dim rstYourRecordsetName As DAO.Recordset
Set rstYourRecordsetName = Me.RecordsetClone
If rstYourRecordsetName.RecordCount = 0 Then
MsgBox "Sorry. We could not locate a record based on the specified
criteria.", vbInformation, "Warning"
DoCmd.Close
End If
End Sub

Sal
www.cedrostec.com
 

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