Instead of having the message box pop up, is it possible to have a line
printed on the report that indicates there aren't any records? This way, I
would have a report page that indicates this because I might need to include
it with reports that I give to my Supervisor.
Thanks!
Then don't cancel the OnNoData event.
Add a label to the report.
Caption: "There were no records to report on."
Set it's visible property to No
Name this label "NoRecs"
Code the Report's OnNoData event:
' MsgBox "No records found." ' This message is optional
Dim ctl as Control
For each ctl in Me.Section(0).Controls
ctl.Visible = False
Next
Me.NoRecs.Visible = True
The above code will make all of the other controls in the detail
section Not Visible (so you don't get #error displayed), and will make
the label visible.
If you wish to hide ALL of the controls on the report, change
For each ctl in Me.Section(0).Controls
to
For each ctl in Me.Controls