View Full Version : Checking if a form has data


ChristopherM
09-22-2001, 06:18 AM
I am sure this is pretty simple but I cannot figure out how to check if the data source for a form (query) is returning any data at the form's On Load event. I have tried using HasData but it seems only to apply to reports. Can anyone help? Thanks

jwindon
09-22-2001, 07:18 AM
Found the answer in the Archives

Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox " No record found", vbOKOnly
Cancel = True
Exit Sub
End If

End Sub



[This message has been edited by jwindon (edited 09-22-2001).]

ChristopherM
09-22-2001, 10:49 AM
Thanks for your help.