Open a form with search criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello Everyone,

I am opening a data entry form based on search criteria from an input box. The problem is that if there is no matc
found, then a blank form is opened. How can I display a "No Record Found" message instead of the blank form when no match is found

Thank yo
James
 
In your code to open the form, add the following line:
On Error Resume Next

Put the following code in the OnOpen event of your form:

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "No Record Found"
Cancel = True
End If

If there is no record, your form won't open!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


James said:
Hello Everyone,

I am opening a data entry form based on search criteria from an input box.
The problem is that if there is no match
found, then a blank form is opened. How can I display a "No Record Found"
message instead of the blank form when no match is found?
 
Back
Top