Custom Toolbar "Print..." Button

  • Thread starter Thread starter JimP
  • Start date Start date
J

JimP

Is there a way to set up the "Print..." button from the "File" menu as a
button on a toolbar?
 
Yes:

The select object command is needed to fix a "focus" bug if you have a form
with a timer function.

For the code that pops up the printer dialog (so the user can change
printers etc).

You can use:

On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint

The select object command is needed to fix a "focus" bug if you have a form
with a timer function. (you can drop the select object if you wish)

The code to print right to the printer while in preview mode can be:

On Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll

Because I have extra room on the menu bar, I actually place two buttons on
my menu. One button allows the use of the print of Pacific printer, or
simply just print to default (the print to default button runs the code as
above the does not prompt the user). the print to specific printer uses the
first example code, and thus the users actually prompt the gets a chance to
slip what printer to use.
 
Back
Top