Hi
I currently have the following code attached to a command button on a switchboard form. This is basic Access 2000.
- Private Sub Print_daily_reports_button_Click()
-
-
On Error GoTo NoData
-
-
DoCmd.OpenReport "Sales Return (TODAY)", acViewNormal
-
DoCmd.OpenReport "Sales/Collections (TODAY)", acViewNormal
-
DoCmd.OpenReport "SRV Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "STPC Voucher Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "FIMs issued (today)", acViewNormal
-
-
NoData:
-
-
If Err.Number = 2501 Then
-
Resume Next
-
End If
-
-
End Sub
For the first 2 reports, I have another report that will just print a separate report when there are no items to report. I am trying to work out the code needed.
I have tried setting on the report's NoData event to print the other report but the macro stops. Is there a way to refer to the NoData event in the code builder as above?
Prior to the above code builder I have also tried a macro to print all the same reports with a separate macro in the sales return report on the nodata event but that comes with the error "The function Open Report is not available now".
Any ideas will be greatly appreciated.
Thanks