I have a print button that opens a report and then opens the print dialog box for printer selection and printing.
It works great using the following code:
DoCmd.OpenReport "MyReport", acViewPreview, acEdit
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "MyReport"
On NoData, I have a message box saying no records, but then the Print Dialog Box still pops up!
This is the code on my reports NoData event:
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There are no records for your selection.", vbOKOnly, " No Records Returned"
Cancel = True
End Sub
Is there code I can add to the Print Button or the NoData event that would bypass the Print Dialog Box?
Thanks
Supmktg
It works great using the following code:
DoCmd.OpenReport "MyReport", acViewPreview, acEdit
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "MyReport"
On NoData, I have a message box saying no records, but then the Print Dialog Box still pops up!
This is the code on my reports NoData event:
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There are no records for your selection.", vbOKOnly, " No Records Returned"
Cancel = True
End Sub
Is there code I can add to the Print Button or the NoData event that would bypass the Print Dialog Box?
Thanks
Supmktg