B
Brian Scheele
I have several users in several areas that print the same report, but need to
print to 4 different destinations, and these destinations are not their
default printers. I wrote code that works, but it is not as efficient as I
would like it to be for a couple of reasons:
1) I have to open the report in print preview first, then select the
printer. I would rather assign the printer to the report and have it stay
that way while the user is using the database.
2) When assigning the printer to the report that is open in print preview, I
have to use the Set rpt.Printer code 3 times because it is case sensitive.
The code below uses a control called PickPrintingOptions that pulls the
user's preferred printer from a list numbered 1 to 4, then assigns the
printer.
Private Sub PrintPickButton_Click()
Dim rpt As Report
DoCmd.OpenReport "Pick", View:=acViewPreview, windowmode:=acHidden
Set rpt = Reports("Pick")
Select Case PickPrintingOptions
Case 1
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Warehouse
LaserJet")
Set rpt.Printer = Application.Printers("\\clark66\Warehouse LaserJet")
Set rpt.Printer = Application.Printers("\\CLARK66\Warehouse
LaserJet")
Case 2
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Warehouse Copier")
Set rpt.Printer = Application.Printers("\\clark66\Warehouse Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Warehouse Copier")
Case 3
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Main Office
Copier")
Set rpt.Printer = Application.Printers("\\clark66\Main Office
Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Main Office
Copier")
Case 4
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Human Resources
Copier")
Set rpt.Printer = Application.Printers("\\clark66\Human Resources
Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Human Resources
Copier")
End Select
DoCmd.OpenReport ("Pick")
DoCmd.Close acReport, "Pick"
End Sub
--
Brian Scheele
IT Manager
Clark Filter
3649 Hempland Road
Lancaster, PA 17601-1323
print to 4 different destinations, and these destinations are not their
default printers. I wrote code that works, but it is not as efficient as I
would like it to be for a couple of reasons:
1) I have to open the report in print preview first, then select the
printer. I would rather assign the printer to the report and have it stay
that way while the user is using the database.
2) When assigning the printer to the report that is open in print preview, I
have to use the Set rpt.Printer code 3 times because it is case sensitive.
The code below uses a control called PickPrintingOptions that pulls the
user's preferred printer from a list numbered 1 to 4, then assigns the
printer.
Private Sub PrintPickButton_Click()
Dim rpt As Report
DoCmd.OpenReport "Pick", View:=acViewPreview, windowmode:=acHidden
Set rpt = Reports("Pick")
Select Case PickPrintingOptions
Case 1
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Warehouse
LaserJet")
Set rpt.Printer = Application.Printers("\\clark66\Warehouse LaserJet")
Set rpt.Printer = Application.Printers("\\CLARK66\Warehouse
LaserJet")
Case 2
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Warehouse Copier")
Set rpt.Printer = Application.Printers("\\clark66\Warehouse Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Warehouse Copier")
Case 3
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Main Office
Copier")
Set rpt.Printer = Application.Printers("\\clark66\Main Office
Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Main Office
Copier")
Case 4
On Error Resume Next
Set rpt.Printer = Application.Printers("\\Clark66\Human Resources
Copier")
Set rpt.Printer = Application.Printers("\\clark66\Human Resources
Copier")
Set rpt.Printer = Application.Printers("\\CLARK66\Human Resources
Copier")
End Select
DoCmd.OpenReport ("Pick")
DoCmd.Close acReport, "Pick"
End Sub
--
Brian Scheele
IT Manager
Clark Filter
3649 Hempland Road
Lancaster, PA 17601-1323