Creating a "record not found" message

  • Thread starter Thread starter hje
  • Start date Start date
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?
 
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
 
Back
Top