How can I programmatically make a query in MS Access default to landscape when printed, specifically when viewing it as a PivotChart? I'm currently attempting this in MS Access 2003, but would like to see a solution for any version.
views:
785answers:
2
+3
A:
The following function should do the trick:
Function SetLandscape()
Application.Printer.Orientation = acPRORLandscape
End Function
Should be able to call this from the autoexec function to ensure it always runs.
ahockley
2008-09-17 03:26:01
A:
Yes ahockley's call sets the application's printer orientation to landscape. I tried an experiment and it worked well. I know this doesn't produce a pivot table, but I didn't setup one to use, so it opens and prints a regular query.
Private sub
Application.Printer.Orientation = acPRORLandscape
DoCmd.OpenQuery "qry1", acViewNormal, acReadOnly
DoCmd.PrintOut acPrintAll
End Sub
If you want to close the query after printing it, add:
docmd.Close acQuery, "qry1", acSaveNo
Brettski
2008-09-17 03:43:13