Send Report (or Labels) to Specific Printer...

Sometimes you want a Report or your Labels to go a specific Printer but you don't want it to become the Default Printer for all of your Reports.  Now you could open each Report that you want to go to a different Printer, go to Page Set-Up and set each one individually.  But what happens when the Printer gets replaced or moved?  What happens if each Department has their own printer, not on the Network but, in their area?  Here is one solution using a Settings table that can be adjusted by you or the End User.
The difficult I do immediately, the impossible takes a little bit longer.
Dim strDefaultPrinter As String
Dim strPrinterName As String
 
'Get current default printer.
strDefaultPrinter = Application.Printer.DeviceName
 
'When storing the Printer name be sure to include the full path and the Printer name, i.e. \\NetworkPath\PrinterName
strPrinterName = fncSetting(25)
 
'If *hardcoding* the Printer name then use the below.
'Note, this way defeats the purpose should the Printer name or location change.
'strPrinterName = "\\NetworkPath\Name of the Printer Goes Here"
 
'Switch to the other Printer
Set Application.Printer = Application.Printers(strPrinterName)
 
If Me.NewRecord Then
    DoCmd.CancelEvent
Else
    DoCmd.OpenReport "rptYoutReportNameGoesHere"
    DoCmd.Close acReport, "rptYoutReportNameGoesHere", acSaveNo
End If
 
'Switch back to original Default Printer
Set Application.Printer = Application.Printers(strDefaultPrinter)
Code for fncSetting() found here.
Reports
Tips (Main)
Home
Print Full or Partial Sheet of Same Labels
Print One or More Labels for One or More Clients (Records)
Multiple copies of 1(one) Report using a Cartesian Product query
Keep Main Report/Subreport Records Together
Multicolumn Report with Images
Filtering Reports
Print Constant Number of Lines (or add a Constant Number of Lines)
Ranking Reports Using Shapes
Custom Page Header
Click to send feedback...
This site uses cookies to collect data on usage. By continuing to browse this site you consent to this policy. Find out more here.