Make report print to a default printer

SteveL13
SteveL13 used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
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.

Author

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?
Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014
Commented:
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

Author

Commented:
Perfect.  Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial