Action if no records found?

  • Thread starter Thread starter Henro
  • Start date Start date
H

Henro

I have a form based on a stored query.
Sometimes (intentional) the query will return NO records.
Then I would like to show a msgbox and stop the form from opening (or close
it immediately)

Any Ideas?

TIA Henro
 
Henro said:
I have a form based on a stored query.
Sometimes (intentional) the query will return NO records.
Then I would like to show a msgbox and stop the form from opening (or close
it immediately)

Private Sub Form_Open(Cancel As Integer)

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Who took all the records??"
Cancel = True
End If

End Sub
 
I like your messagebox :)

Thank you!


rkc said:
Private Sub Form_Open(Cancel As Integer)

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Who took all the records??"
Cancel = True
End If

End Sub
 
Back
Top