Blank report opens when no data - how to avoid this?

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

Guest

MS Access 2K, Windows XP
====================
Hi,

I have an unbound report that contains 3 other reports that are bound to
separate queries. I open the main report from a form after specifying
criteria.

Everything is working the way it should when there is data to display,
except when there is no data to display, the report opens with a blank page.

I have the following in the No Data event of the main report as well as the
3 other reports included on the main report:
msgbox "No data to display."
cancel=true

Am I missing something here? In other reports, when there is no data, this
works by displaying the message and not opening the report.

Would appreciate some help on this so that if there is no data to display
(meaning all the 3 reports have no data), then instead of opening a blank
report, a message is displayed.

Thanks!

-Amit
 
Reports have a NoData event. You can add code to this event to cancel the
load of the report in the event no records are returned.

Look at the event in the online help for an example.

Rick
 
Rick,

Thanks for your response, but if you read my original post, I do mention
that I have the code you mentioned in the No Data event of the report.

Just wondering if there is special handling if the sub-reports contained on
the main report have no data, which is the case with me.

-Amit
 
Back
Top