Suppress error on report

greenfalcon

Registered User.
Local time
Today, 05:52
Joined
Aug 22, 2006
Messages
34
I have a report that is linked to a query... lets say my query returns no records the report comes up with a whole bunch of #Errors on it. How do i prevent this from happening?

thanks

Green
 
If you are using Access 2000, or above, you can go into design mode on your report, select the properties (making sure the report properties are displayed) and go to the events tab and then enable an event procedure under ON NO DATA.

put this code in:

Code:
Msgbox "There is no data available for this report", vbInformation, "No Data"
Cancel = True
Exit Sub

You will likely have to trap for error 2501 in the code that opens the report, otherwise it will report that the user has canceled the operation.
 

Users who are viewing this thread

Back
Top Bottom