No Data Msg Box

S

Stevene James

Hi
I have a select query that looks up from one table based on the users
parameter input.

when no data is returned i am presented with just a blank sheet. Is it
possible to display a msg box displaying "no record found" or somthing like
that?
 
A

Allen Browne

Not if you use the query as the interface.

You could create a form in datasheet view (so it looks like a query), bind
it to the query, and cancel its Open event if there are no records:

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