[AccessD] Printer selection

Jim Dettman jimdettman at verizon.net
Mon Jan 11 10:28:24 CST 2010


Arthur,

  For A2003 and up:

'Changes the Default Printer, then resets it to the original Printer. 
'This will only work if the report is set up to Print to the Default 
'Printer 
  
Set Application.Printer = Application.Printers("Acrobat PDFWriter") 
  DoCmd.OpenReport "<Your Report Name>", acViewNormal, , , acWindowNormal 
  
'Reset the Default Printer back to the way it was 
Set Application.Printer = Nothing 


To a specific device:
'The following code will Print rptInvoices to the Acrobat PFDWriter Printer 
Dim rpt As Report 
  
DoCmd.OpenReport "rptInvoices", View:=acViewPreview, WindowMode:=acHidden 
  
Set rpt = Reports("rptInvoices") 
Set rpt.Printer = Application.Printers("Acrobat PFDWriter") 
  
DoCmd.OpenReport "rptInvoices" 
DoCmd.Close acReport, "rptInvoices" 

Modifying Printer characteristics:
'Open rptInvoices in Design view, change 3 of its Properties 
'Print the report, and then close the report. 
  
Const conReport As String = "rptInvoices" 
  
DoCmd.OpenReport conReport, View:=acViewPreview, WindowMode:=acHidden 
  
'Force the printer to look to the upper bin for paper, print on 
'Monarch-size envelopes, and Print two copies, set orientation to 
'Landscape 
With Reports(conReport).Printer 
  .PaperBin = acPRBNUpper 
  .PaperSize = acPRPSEnvMonarch 
  .Copies = 2 
  .Orientation = acPRORLandscape 
  .Duplex = acPRDPVertical 
  .PrintQuality = acPRPQMedium 
End With 
  
'Now print the report. 
DoCmd.OpenReport conReport 
DoCmd.Close acReport, conReport 

Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Monday, January 11, 2010 9:54 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Printer selection

How do I specify which printer to send a report to? Most of the reports in
this app go to one printer, but some of them are intended to become Acrobat
files. How do I tell Access that these reports are destined for the Acrobat
virtual printer?

TIA,
Arthur
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list