I have a form based on a Find Unmatched Query.
I need the functionality of the No Data event found on reports to launch a message or cancel the Open Form event.
How can I do this on a form?
This will simply display a messagebox, then close when OK is pressed
Code:
Private Sub Form_Load()
If Me.Recordset.RecordCount < 1 Then
MyMsg = MsgBox("There Are No Records!", vbOKOnly, "No Records!")
DoCmd.Close
End If
End Sub
This will let the form show briefly, them popup a messagebox, then close everything when OK is clicked on in the messagebox
Code:
Private Sub Form_Load()
If Me.Recordset.RecordCount < 1 Then Me.TimerInterval = 1000
End Sub
Code:
Private Sub Form_Timer()
MyMsg = MsgBox("There Are No Records!", vbOKOnly, "No Records!")
Me.TimerInterval = 0
DoCmd.Close
End Sub