By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,400 Members | 953 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,400 IT Pros & Developers. It's quick & easy.

Report Orientation

P: 23
Access 2003. I've set the report orientation to landscape using VB. The report that pops up is in Portrait view, but page orientation is correctly set to Landscape and it prints in landscape orientation. The really odd thing is that if I step through the code using F8, it will open in PrintPreview Mode as Landscape.

The relevant code is as follows.

Expand|Select|Wrap|Line Numbers
  1.  rpt.Section(acDetail).Visible = False
  2.  
  3.    With rpt
  4.     .Printer.Orientation = acPRORLandscape
  5.     End With
  6.     DoCmd.OpenReport rpt.Name, acViewPreview
  7.  
  8.  
  9.  
  10.      'reset all objects
  11.      rs.Close
  12.      Set rs = Nothing
  13.      Set rpt = Nothing
  14.      Set db = Nothing
This comes at the very end, right before END SUB. Prior to this I collect user's inputs from list boxes, generate a SQL string, and pass it to the report. The report is then opened in design view, all the text boxes and labels are arranged, and then this code comes.

Any thoughts on how to have it open directly into Landscape Orientation?
Sep 26 '08 #1
Share this Question
Share on Google+
4 Replies


P: 13
What is orientation set to in design mode (File..Page Setup...Page)? This may be overriding any code you have.
Sep 26 '08 #2

NeoPa
Expert Mod 15k+
P: 31,661
...
The report is then opened in design view, all the text boxes and labels are arranged, and then this code comes.

Any thoughts on how to have it open directly into Landscape Orientation?
But there is no orientation within design mode.

It either opens in Design mode or one of Preview or Print. If either of the latter two then orientation effects what's shown. For the first it doesn't (surely). Am I missing something obvious here?
Sep 26 '08 #3

P: 13
Have you tried printing it and if so, does it print in landscape? I tried something similar to your problem. I created a bound report, with portrait orientation. I then added coding to open it in landscape. When I previewed the report, it opened in portrait but printed in landscape.

The only way to open the preview in landscape is to set the orientation to landscape in design mode.

You can't open design mode in landscape.

Unless I'm way off base......
Sep 26 '08 #4

P: 23
Yes, it prints in landscape. I open it in Design view to set all the controls in place and this is when I set it to Landscape Orientation. I then open it in Preview form. IF you do this manually, it will open in Landscape. However, when the code specifies it, it only opens in portrait.

Why? and how do i fix it. I know the code is correct because checking page setup it clearly says "Landscape Orientation" and like I said, if you place a break before the set orientation line of code and then step through it, it opens in Landscape properly. So what do I do to make it open in Landscape when the code is run normally?
Sep 26 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.