View Full Version : Printing only when there is data


Access_Monkey87
10-15-2004, 02:10 AM
For a macro that prints a report directly from a switchboard, which condition should I use to only print when the Event function in the report does not equal 'Nodata'?

Uncle Gizmo
10-18-2004, 04:21 PM
Unfortunately when I started using Access I skipped macros on the understanding that it was better to learn the VBA so I know a little bit about macros but not a lot!

Reports have an "on no data" Event which is triggered when the report has no data! I use the following code in some reports to cancel it if there is no data:


Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "No data to Display"
Cancel = True
End Sub

I'm not sure if this is much help to you but it may give you an idea of what can be done.