This took a few days of playing but I finally got it working.
You will need to use this code in a Print Button on your form.
Change the strReportName to your report.
Change the constant for the printer to your desired printer.
You will need to use this code in a Print Button on your form.
Change the strReportName to your report.
Change the constant for the printer to your desired printer.
Code:
' Set Default Printer to the Windows Default Printer
Set Application.Printer = Nothing
'Get Default Printer
Dim strDefaultPrinter As String
strDefaultPrinter = Application.Printer.DeviceName
Dim strReportName As String
strReportName = "CasePrint"
'Open the report so we can set the printer
DoCmd.OpenReport strReportName, acViewReport, , , acHidden, Me.Name
'Printer examples for Local Printers
Const c_strReportPrinterName As String = "Dell 2330dn Laser Printer XL"
'Const c_strReportPrinterName As String = "Microsoft XPS Document Writer"
'Printer Example for Network Printer
'Const c_strReportPrinterName As String = "\\PServer01\Dell Laser Printer 5310n"
Debug.Print "0: Report Name = " & strReportName
Debug.Print "0: Use Default Report Printer = " & Reports(strReportName).UseDefaultPrinter
Debug.Print "0: App Default Printer = " & Application.Printer.DeviceName
Debug.Print "0: Report Default Printer = " & Reports(strReportName).Printer.DeviceName
Debug.Print "0: Desired Printer = " & Application.Printers(c_strReportPrinterName).DeviceName
Set Reports(strReportName).Printer = Application.Printers(c_strReportPrinterName)
Debug.Print "1: Report Name = " & strReportName
Debug.Print "1: Use Default Report Printer = " & Reports(strReportName).UseDefaultPrinter
Debug.Print "1: App Default Printer = " & Application.Printer.DeviceName
Debug.Print "1: Default Report Printer = " & Reports(strReportName).Printer.DeviceName
Debug.Print "1: Desired Printer = " & Application.Printers(c_strReportPrinterName).DeviceName
DoCmd.RunCommand acCmdSaveRecord
' OK - Now let's print the record.
DoCmd.OpenReport strReportName, acViewNormal, , , acHidden, Me.Name