Report Orientation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • J360
    New Member
    • Aug 2008
    • 23

    Report Orientation

    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.

    Code:
     rpt.Section(acDetail).Visible = False
       
       With rpt
        .Printer.Orientation = acPRORLandscape
        End With
        DoCmd.OpenReport rpt.Name, acViewPreview
        
        
        
         'reset all objects
         rs.Close
         Set rs = Nothing
         Set rpt = Nothing
         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?
  • EManning
    New Member
    • Sep 2008
    • 13

    #2
    What is orientation set to in design mode (File..Page Setup...Page)? This may be overriding any code you have.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32656

      #3
      Originally posted by J360
      ...
      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?

      Comment

      • EManning
        New Member
        • Sep 2008
        • 13

        #4
        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......

        Comment

        • J360
          New Member
          • Aug 2008
          • 23

          #5
          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?

          Comment

          Working...