Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set printer option for the Print Button...

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
I want the button to print to a specific printer and not just the default one.

Dim stDocName As String

stDocName = "OLetter"
DoCmd.OpenReport stDocName, acNormal, PRINTER XYZ

Can someone please help me. Thanks.

-WB
 
I want to use the same thing as you want. Did you get any responses???
 
NOPE. Still waiting on someone out there who has to know the answer to this simple question that I am not having luck find and answer for it. Anyone please HELP!!! Thanks.
 
If you still have the problem:

Open your report in design view, add the following to the Report's On Activate event:

Private Sub Report_Activate()
On Error Resume Next
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, Me.Name
End Sub

Close and save the changes.

Now open the form where the cmdbutton is located to open the report. I'm assuming you are using DoCmd.OpenReport method to make your report print. Change that line to:

DoCmd.OpenReport "YourReportName", acViewPreview
(change "YourReportName" to the actual name of your report)

Don't worry about the acPreview argument causing the report to show on screen. The earlier code you placed in the report will keep this from happening.

When you click your button, the print dialog box will open so you can choose the printer options, the report will then print and close without becoming visible on screen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top