Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

on open event

Status
Not open for further replies.

MadMax7

MIS
Feb 17, 2004
62
GB
I hope someone can help, i have the following code on the open event of a form to find a specific record

Me.Recordset.MoveFirst
Do Until Me.Property_Ref = Forms!frmPropertyBasicDetails!PropertyRef Or Me.Recordset.EOF
Me.Recordset.MoveNext
Loop

thios works fine if there is a matching record,but in the event there is not a matching record i want to know how i could get a msg box to appear telling the user no matching record exists and then the form will go to a new blank record.


 
Perhaps something like this ?
...
Loop
If Me.Recordset.EOF Then
MsgBox "blah blah about no matching record exists"
DoCmd.RunCommand acCmdRecordsGoToNew
End If

You may also consider the FindFirst and NoMatch method/property of the DAO.Recordset object instead of a loop ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top