Print dialog in MS Access

I had a report that would automatically print, but there was no way to select the printer or the tray to be printed from. I found that you can pop up the print dialog from code, so I did this:

Private Sub cmdReportPrint_Click()
On Error Resume Next ' needed in case they click Cancel
DoCmd.OpenReport "rptToPrint", acViewPreview
DoCmd.RunCommand acCmdPrint ' bring up the dialog
DoCmd.Close acReport, "rptToPrint", acSaveNo ' close after printed
End Sub

Just another trick in the bag.

Leave a Comment

Comments are moderated.