This worked for me, thanks!
Below is what I ended up with after adapting the code you provided. It is a
procedure prints a specified report to a printer specified by a number. The
code could probably be made shorter, but any performance gains would probably
be insignificant. Still to deal with the case sensitivity, which is why I
use the On Error Resume next and then follow with setting the printer 3
different ways. I can live with that. SERVER07 can appear 3 different ways
depending on which computer is running it.
Private Sub PrintReportToUserSpecifiedPrinter(ByVal strReportName As String,
ByVal intPrinterChoice As Integer)
' PrinterChoice comes from the radio button values in the options
Dim strDefaultPrinter As String, strReportDestination As String
strDefaultPrinter = Application.Printer.DeviceName 'Get the current
default printer
Select Case intPrinterChoice
Case 10
strReportDestination = "BOL Program - Main Office Copier"
Case 11
strReportDestination = "BOL Program - HR Copier"
Case 12
strReportDestination = "Main Office Color LaserJet"
Case 13
strReportDestination = "DCC Sales LaserJet"
Case 20
strReportDestination = "Warehouse LaserJet"
Case 21
strReportDestination = "Warehouse Copier"
Case 22
strReportDestination = "Main Office Copier"
Case 23
strReportDestination = "Human Resources Copier"
Case 30
strReportDestination = "Main Office 6x4 Label Printer"
Case 31
strReportDestination = "Main Office Label Printer"
Case 32
strReportDestination = "HR Label Printer"
Case Else
strReportDestination = strDefaultPrinter
End Select
On Error Resume Next
Set Application.Printer = Application.Printers("\\SERVER07\" &
strReportDestination)
Set Application.Printer = Application.Printers("\\Server07\" &
strReportDestination)
Set Application.Printer = Application.Printers("\\server07\" &
strReportDestination)
On Error GoTo 0
DoCmd.OpenReport strReportName
Set Application.Printer = Application.Printers(strDefaultPrinter)
End Sub
--
Brian Scheele
IT Manager
Clark Filter
3649 Hempland Road
Lancaster, PA 17601-1323
"Albert D. Kallal" wrote:
> what version of ms-access?
>
> In access 2002 and later, there is a built in printer object, and it lets
> you switch the printer with ease.
>
> You can use:
>
> Set Application.Printer = Application.Printers("HP LaserJet Series II")
>
> So, to save/switch, you can use:
>
> dim strDefaultPrinter as string
>
> get current default printer.
> strDefaultPrinter = Application.Printer.DeviceName
>
> switch to printer of your choice:
>
> Set Application.Printer = Application.Printers("HP LaserJet Series II")
>
> do whatever...print the 4 reports.
>
>
> Switch back.
>
> Set Application.Printer = Application.Printers(strDefaultPrinter)
>
> I think using the Application.Printer is a good deal easier, and you don't
> have to open the report first.....
>
> so, set the printer....print the reports...and then set the printer back to
> what it was before...
>
> If you are using a version of ms-access prior to access 2002, then you could
> use this printer switch code of mine here:
>
> http://www.members.shaw.ca/AlbertKal.../msaccess.html
>
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
>
>
>