on no data

SueBK

Registered User.
Local time
Tomorrow, 01:41
Joined
Apr 2, 2009
Messages
197
I have a report comprising of about dozen or so sub-reports. These sub-reports are also available to users as stand alone reports.

Some of the reports will occassionally have no data. ie there may be no safety issues this month. This is causing the reports to fall over.

I notice there is a "on no data" coding option. I'm wondering what sort of code one puts in here? Ideally, if there's no data in the sub-report I'd like to insert words to effect of "nil to report". Is that possible?
 
In the On No Data event you can put

Msgbox "There was no data to display.", vbInformation, "No Data"
Cancel = True


which will keep it from opening and display the message box.

However you will also need to trap for Error 2501 in the event which tried to open the report.
 

Users who are viewing this thread

Back
Top Bottom