Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically setting Printer.PageSize options

Status
Not open for further replies.

jfriedrich

Programmer
Aug 11, 2006
3
CA
While working in Access 2003, it would appear that you lose your printer settings in reports periodically. Since this wreaks havoc on our users printing legal size reports, I am working on setting up the printer settings in VBA.
My code is simple and works to print:
dblRptWidth = prptReport.Width + prptReport.Printer.BottomMargin + prptReport.Printer.TopMargin + prptReport.Printer.LeftMargin + prptReport.Printer.RightMargin
Select Case dblRptWidth
Case dblRptWidth > 12240 And dblRptWidth < 15850
prptReport.Printer.PaperSize = acPRPSLetter
prptReport.Printer.Orientation = acPRORLandscape
Case dblRptWidth <= 12240
prptReport.Printer.PaperSize = acPRPSLetter
prptReport.Printer.Orientation = acPRORPortrait
Case Else
prptReport.Printer.PaperSize = acPRPSLegal
prptReport.Printer.Orientation = acPRORLandscape
End Select

This code is fired on Open of the report, and prints okay, but the preview is wrong. To correct the print preview, you must click File, Page Setup, Ok.
Does anyone know of a way to redraw or refresh the preview??

Thanks.
 
Thank you.
I did look at the article this morning and it doesn't really help in my situation.
Since I am compiling to an MDE, I cannot open the form in design view first (run-time error occurs). I am already running the code on Open. The code is running just fine to setup the printers, I just can't get the consistency between the Print Preview and the Print.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top