Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Reports with NO DATA

Status
Not open for further replies.

KatGraham

Programmer
Feb 12, 2003
58
US
How do I get a report NOT to print if there are no records in the underlying query? Or how do I show a message "Report contains NO DATA, try other parameters".

Help!
 
There's an On No Data property in each report.

Within this event include the following code:

Cancel = True
msgbox("Report contains NO DATA, try other parameters.")

in the code that sends the report to be printed include error capture code:

On Error GoTo Errorhandler

DoCmd.OpenReport "YourReportName", acViewPreview

'at the bottom of the same proc include the following:

ErrorHandler:

Err.Clear

Hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top