pdvsa
asked on
No Data and a Form
Experts,
I see that a form does not have a "On No Data" event like a report has.
How can I craft an On No Data for a form?
thank you.
this is what I use for a report:
Private Sub Report_NoData(Cancel As Integer)
MsgBox "No Data"
Cancel = True
End Sub
I see that a form does not have a "On No Data" event like a report has.
How can I craft an On No Data for a form?
thank you.
this is what I use for a report:
Private Sub Report_NoData(Cancel As Integer)
MsgBox "No Data"
Cancel = True
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<<on form's open event>>
Really don't want to use OnOpen for this; that's a little too early and might be hit or miss. Your not guaranteed that the forms recordset has been loaded until you hit OnLoad.
JimD.
Really don't want to use OnOpen for this; that's a little too early and might be hit or miss. Your not guaranteed that the forms recordset has been loaded until you hit OnLoad.
JimD.
ASKER
Perfect. thank you
if Me.Recordset.RecordCount = 0 then
Cancel = true
end if
DoCmd.OpenForm in that case will produce runtime error which you have to handle
http://www.pcreview.co.uk/forums/no-data-form-open-t3987721.html