Prevent display of blank query/form

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

Guest

i have a parameter query based on inputs from the user. A form based on this
query pops-up to display matched records. My question is, how can i prevent
the display of a blank query/form, that is, when no matching records are
found? Instead, I want that the program will inform the user through a MsgBox
that "No Records Found". thanks in advance.
 
Cancel the Open event of the form it if has no records:

Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
MsgBox "No Records Found"
End If
End Sub
 
Back
Top