<p>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.</p>

[{'answer_id': 79635, 'author': 'ahockley', 'author_id': 8209, 'author_profile': 'https://Stackoverflow.com/users/8209', 'pm_score': 3, 'selected': True, 'text': '<p>The following function should do the trick:</p>\n\n<pre><code>Function SetLandscape()\n   Application.Printer.Orientation = acPRORLandscape\nEnd Function\n</code></pre>\n\n<p>Should be able to call this from the autoexec function to ensure it always runs.</p>\n'}, {'answer_id': 79740, 'author': 'Brettski', 'author_id': 5836, 'author_profile': 'https://Stackoverflow.com/users/5836', 'pm_score': 0, 'selected': False, 'text': '<p>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.  </p>\n\n<pre><code>Private sub\n    Application.Printer.Orientation = acPRORLandscape\n    DoCmd.OpenQuery "qry1", acViewNormal, acReadOnly\n    DoCmd.PrintOut acPrintAll\nEnd Sub\n</code></pre>\n\n<p>If you want to close the query after printing it, add:</p>\n\n<pre><code>docmd.Close acQuery, "qry1", acSaveNo\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/78757', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3155/']