Make report print to a default printer

I'm using this code to printer a report.  But I don't want the user to have to select the printer.  Just print to his/her default printer.  How can this be done?

Here's my current code:

    DoCmd.OpenReport "rptInboundRecord", acViewPreview, , "[ID]=" & Me.txtID, acHidden
    DoCmd.RunCommand acCmdPrint
    DoCmd.Close acReport, "rptInboundRecord", acSaveNo

Open in new window

Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The DoCmd.RunCommand acCmdPrint is causing the dialog box to display. Remove that line, and if you just want to print the report:

DoCmd.OpenReport "rptInboundRecord", acViewNormal, , "[ID]=" & Me.txtID, acHidden
If you define a default printer on your system and create the report to print to that, it will also print to the default printer for your client.
SteveL13Author Commented:
Pat, I have my printer set as the default in my system.  And in the design of the report I have it set to Default Printer.  But I still get the widow to select a printer when I click print.  Maybe that is how it is supposed to work?
SteveL13Author Commented:
Perfect.  Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.