[AccessD] Access 2007, Set Printer Properties for report

Lawrence Mrazek lmrazek at lcm-res.com
Thu Apr 15 12:57:02 CDT 2010


Hi Folks:

I inherited an app written in Acc2007 (computer in question is running sp2).

They have a couple of buttons/reports that need to be able to be quickly
sent to various printers, and I'm a bit stuck, specifically in setting
the paper size via the "acPRPSUser" constant ... any ideas? I can get Access
to switch default printers, but haven't been able to set all of the sizes.

Currently using the following:

stDocName = ReportName


   sRpt = stDocName

   DoCmd.OpenReport stDocName, acViewDesign
       'Set the printer to default
       Set rpt = Reports(sRpt)
     '  rpt.UseDefaultPrinter = True
'       Printers ("Adobe PDF")
        rpt.Printer = Application.Printers("Canon iR c2880/c3380 PCL5c") '
Sets the printer name.
       ' rpt.Printer = Application.Printers("Adobe PDF") ' Sets the printer
name.

       'set the prt object to the Application printer
       Set prt = rpt.Printer
       With prt
           'Margins
'           .LeftMargin = 360     ' in units of twips 1"=1440twips / 10mm =
567twips
'           .RightMargin = 360
'           .TopMargin = 901
'           .BottomMargin = 238
'           .ItemSizeHeight = 8640
'           .ItemSizeWidth = 8640
           .PaperBin = acPRBNTractor
           .PaperSize = acPRPSUser



           ' Application.Printer.ItemSizeHeight = 6000
           ' Application.Printer.ItemSizeWidth = 6000
           '
           'Orientation
           .Orientation = acPRORPortrait
           'Column / Row Spacing
           .ColumnSpacing = 360
           .RowSpacing = 0
       End With
   DoCmd.Close ObjectType:=acReport, ObjectName:=sRpt, Save:=acSaveYes
   DoCmd.OpenReport stDocName, acViewPreview


Thanks in advance:

Larry M.
lmrazek at lcm-res.com



More information about the AccessD mailing list