close report when there is no data to display

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

Guest

What code would I use to automatically close a report that has no data? I
have played around with the 'on no data' code but am not good enough yet to
get it to work.

Please help!
 
BLTibbs said:
What code would I use to automatically close a report that has no data? I
have played around with the 'on no data' code but am not good enough yet to
get it to work.


The NoData event procedure only needs the one line:
Cancel = True
between the Sub and End Sub statements.

Don't confuse the OnNoData property with the NoData event
procedure, The OnNoData property must be set to
[Event Procedure]

After you get that working, you will receive a message box
stating that the report was cancelled. If you are opening
the report from a form button's Click event, you can
suppress the message by ignoring error number 2501. Post
back with the code for the button's procedure if you need
help straightening this out.
 
Back
Top