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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a box show up to allow users to select a printer? 12

Status
Not open for further replies.

Blitz

Technical User
Jul 7, 2000
171
US
I have a button on a form that prints a report, the problem is it automatically prints to the default printer. I want to make it so that when the button is clicked it opens a printer box (like when you go to file, print, in word) so that different printers can be selected. Is there any easy way to do this?
 
as I understand it, you can either have a report print to the default printer or a specific printer. You may wish to look at a utility program called fineprint which captures print commands, allows various options to be changed, including which of many printers it goes too... of course then you may encounter problems with paper sizes and margins... but that's another story...

Cheers, Jon.
 
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.

HTH :-Q
RDH


Ricky Hicks
rdhicks@mindspring.com

 
It worked perfectly, Thanks
 
Rick,
Awesome trick!!! I've been looking for this for a long time.

Thanks!!
 
You really did provide an excellent tip! When I use it, however, there is no option for print preview. Is it because of my particular printer's dialog box? I'm just hoping that there might be another dialog box that offers the print preview also. If not I will have to add a button to send to Print or Preview. Even if there is no solution for this you really helped us out here!

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top