Print to network and local printers

latex88

Registered User.
Local time
Today, 17:16
Joined
Jul 10, 2003
Messages
198
I have small network setup between two computers and five receipt printers. I have .accdr front end on both computers with .accdb back end stored on Computer B.

Computer A: Front end and a printer (Printer A)
Computer B: Front end, back end and four printers (Printer A,B,C,D)

I have gotten codes from the web that work quite well when Computer A printing to its own printer and to all the printers connected to Computer B. The code is below. The issue I have is that when I execute the same sub routine on Computer B that need to print to the same printers, it doesn't seem to like the way the printers are pointed. It will print rptA fine, but it shuts down after that. I suspect it does not like the way the printers' path are referenced since they are considered local printers to Computer B?

Private Sub cmdPrint_Click()

DoCmd.OpenReport "rptOne", acViewNormal ‘Print to local printer (Printer A)
Dim defPrinter As String, NewPrinter As Printer
defPrinter = Application.Printer.DeviceName
Set NewPrinter = Application.Printers("\\ComputerB\PrinterB") ‘Prints to PrinterB
Set Application.Printer = NewPrinter
DoCmd.OpenReport "rptTwo ", acViewNormal
DoCmd.Close acReport, " rptTwo ", acSaveNo
Set NewPrinter = Application.Printers(defPrinter)
Set Application.Printer = NewPrinter

Dim defPrinter2 As String, NewPrinter2 As Printer
defPrinter2 = Application.Printer.DeviceName
Set NewPrinter2 = Application.Printers("\\ComputerB\PrinterC) ‘Prints to PrinterC
Set Application.Printer = NewPrinter2
DoCmd.OpenReport " rptThree ", acViewNormal
DoCmd.Close acReport, " rptThree ", acSaveNo
Set NewPrinter2 = Application.Printers(defPrinter)
Set Application.Printer = NewPrinter2

Dim defPrinter3 As String, NewPrinter3 As Printer
defPrinter3 = Application.Printer.DeviceName
Set NewPrinter3 = Application.Printers("\\ComputerB\PrinterD") ‘Prints to PrinterD
Set Application.Printer = NewPrinter3
DoCmd.OpenReport " rptFour", acViewNormal
DoCmd.Close acReport, " rptFour", acSaveNo
Set NewPrinter3 = Application.Printers(defPrinter)
Set Application.Printer = NewPrinter3
End Sub
 
http://www.access-programmers.co.uk/forums/showthread.php?t=187485
Have not tried this myself. Could you let others know if it if helpful?


Food For thought: My application does not send reports directly to the printer. The new version of Access dropped the reports modules. My preference is to create reports in Excel and save them on the network folder. Then the user can go to the folder and print the report.
The reason for this is Access is cloud enabled via Citrix (or remote terminal). So, the user is anywhere in the US or in the field with low bandwidth. By using Save As for reports, the user can open them and use their own local computer settings.
 

Users who are viewing this thread

Back
Top Bottom