No data

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

Guest

I have a form using query criteria as record source.
Is there way to post a message and cancelling the query if there is no data
querying like in the report "on no data" event?

Thanks
 
I am not sure what you mean by 'cancelling the query' but you can put the
following code in a form's Open eventHandler to stop the form opening if the
record source returns no data

If Me.Recordset.RecordCount = 0 Then
MsgBox "No Records", vbOKOnly
Cancel = True
End If

Hope This Helps
Gerald Stanley MCSD
 
Back
Top