Print Margin Problem in Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tdw
    New Member
    • Mar 2007
    • 206

    Print Margin Problem in Reports

    Hi,

    I have searched for this answer to no avail. I've found some very similar questions, but no answers that seem to apply.

    Here's the deal: All reports work fine on my computer. My boss, however, can't get reports to print correctly from his. What is happening is that his page margins in the 'page setup' keep resetting to include over 7" on the right, thus only allowing a narrow sliver on the left side of the page to print, thus, in turn, causing a one page report to turn into over 30 pages of tiny bits.

    I tried correcting the margins, and they stay put, until....

    At this point I should explain how the database opens:

    1. It is a Front-end Back-end database. The back-end is on the server, front-end on each user's computer.

    2. Often I make updates and improvements to the design of the forms and reports in the front-end, and then save the changes to a copy of the front-end, which also resides on the server.

    3. Each user has an icon on their desktop which launches a .bat file which copies the front-end database file from the server onto the user's computer, and then it opens that newly copied front-end database file on their computer. This way, every time someone opens the database, they are sure to have the latest changes and improvements.

    Now back to the print margin issue:

    On my boss's computer, after I have adjusted the margins using the report's page setup, they stay fixed as long as the database remains open. They ALSO stay fixed if I close the database, but then re-open it directly from the front-end file on his computer (skipping the .bat file). However, if I open it the normal way, using the .bat file icon (meaning that the copy on the server copies over to his computer and then opens), now suddenly his margins are all screwed up again.

    I have tested it and tested it, and it does that on his computer every time, and never on mine! Mine opens using the same process as his.

    Help!

    Thanks ahead of time
  • Lysander
    Recognized Expert Contributor
    • Apr 2007
    • 344

    #2
    I think this is related to another question I answered yesterday about 'currency' format. How does 'Currency' format relate to print margins you say!

    When you specify 'Currency', Access does not store currency, it stores whatever currency format you have on your PC at the time.

    I bet that when you set up your report and give it say, 1cm margin, it does not store 1cm margin, it looks at your print driver and works out what code to send based on that driver.

    Go to a different PC, with a different print driver, and the margins will change.

    This is just a guess, I can't test it here but check out your boss's PC has the same print driver as you. If not, see if you can make them the same and see if that solves your problem

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      I haven't actually tried this, but how about pro-grammatically changing the Left and Right Margins for your Report, then Print and Close it? The code should be:
      [CODE=vb]
      'Programmatical ly change the Left and Right Margins
      Const conTwipsPerInch As Long = 1440
      Const conReport As String = "<Your Report Name>"

      DoCmd.OpenRepor t conReport, View:=acViewPre view, WindowMode:=acH idden

      With Reports(conRepo rt).Printer
      .LeftMargin = 1 * conTwipsPerInch '1" Left Margin
      .RightMargin = 0.5 * conTwipsPerInch '1/2" Right Margin
      End With

      DoCmd.OpenRepor t conReport, acViewNormal
      DoCmd.Close acReport, conReport[/CODE]

      Comment

      • tdw
        New Member
        • Mar 2007
        • 206

        #4
        Originally posted by ADezii
        I haven't actually tried this, but how about pro-grammatically changing the Left and Right Margins for your Report, then Print and Close it? The code should be:
        [CODE=vb]
        'Programmatical ly change the Left and Right Margins
        Const conTwipsPerInch As Long = 1440
        Const conReport As String = "<Your Report Name>"

        DoCmd.OpenRepor t conReport, View:=acViewPre view, WindowMode:=acH idden

        With Reports(conRepo rt).Printer
        .LeftMargin = 1 * conTwipsPerInch '1" Left Margin
        .RightMargin = 0.5 * conTwipsPerInch '1/2" Right Margin
        End With

        DoCmd.OpenRepor t conReport, acViewNormal
        DoCmd.Close acReport, conReport[/CODE]
        Thanks, I will try that and let you know. Currently I'm using a macro, but if I understand this correctly, this code would take the place of that macro.

        In response to Lysander, yes the same print drivers are on all computers. In fact, my boss's computer does exactly the same thing no matter which of our several printers is used. I tried changing his default printer to each of them, and it didn't change anything. So it's definitely something about his computer (or his copy of Access?).

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by tdw
          Thanks, I will try that and let you know. Currently I'm using a macro, but if I understand this correctly, this code would take the place of that macro.

          In response to Lysander, yes the same print drivers are on all computers. In fact, my boss's computer does exactly the same thing no matter which of our several printers is used. I tried changing his default printer to each of them, and it didn't change anything. So it's definitely something about his computer (or his copy of Access?).
          Thanks, I will try that and let you know. Currently I'm using a macro, but if I understand this correctly, this code would take the place of that macro.
          Yes it would, your current Macro will be replaced by this code.

          Comment

          • tdw
            New Member
            • Mar 2007
            • 206

            #6
            Originally posted by ADezii
            Yes it would, your current Macro will be replaced by this code.
            This is really weird. I made the changes, and the changes work perfectly well, except for on my boss's computer!! His computer still does exactly the same thing! He has no trouble with printing from any other program.

            Here's an example of what it does.

            Let's use this paragraph as the example. Obviously the report is more than just a paragraph of text, but hopefully you'll see what I'm trying to demonstrate. Instead of printing the report as a whole, it prints in pieces. So if this paragraph were the form it would be like this:

            page 1

            Let's use this

            page 2

            paragraph as the

            page 3

            example. Obviously

            page 4

            the report is more

            page 5

            than just

            etc etc etc until finally the whole thing has printed in pieces (around 30 pages, when the report should have all been on one page).

            Comment

            • tdw
              New Member
              • Mar 2007
              • 206

              #7
              Originally posted by tdw
              This is really weird. I made the changes, and the changes work perfectly well, except for on my boss's computer!! His computer still does exactly the same thing! He has no trouble with printing from any other program.

              Here's an example of what it does.

              Let's use this paragraph as the example. Obviously the report is more than just a paragraph of text, but hopefully you'll see what I'm trying to demonstrate. Instead of printing the report as a whole, it prints in pieces. So if this paragraph were the form it would be like this:

              page 1

              Let's use this

              page 2

              paragraph as the

              page 3

              example. Obviously

              page 4

              the report is more

              page 5

              than just

              etc etc etc until finally the whole thing has printed in pieces (around 30 pages, when the report should have all been on one page).
              bump bump bump bump bump :-)

              Comment

              • nspader
                New Member
                • Mar 2008
                • 78

                #8
                2 questions. These both pertain to the Access Options menu.

                Under the General Tab is the Track auto name corrections checked? If so It shouldnt be. That will keep the Margins from defaulting to the PC's and will maintain the DB's margin settings.

                Secondly, under the same tab do the margins's show the way you would want them to.

                I found that this was a problem with my reporting. I would set the margins and the view (landscape or portrait) when designing and save it. But as soon as I close access and reopen it I would lose what I did.

                A way that I used to ensure this wouldnt happen on a nother PC was to use a line of code in the swtichboard load option (or whatever form appears when the program is opened). I will place it below in case you want to try it.

                Code:
                Private Sub Form_Open(Cancel As Integer)
                
                    Application.SetOption "Left Margin", 0.5
                    Application.SetOption "Right Margin", 0.5
                    Application.SetOption "Top Margin", 0.5
                    Application.SetOption "Bottom Margin", 0.5
                    Application.SetOption "Track Name AutoCorrect Info", False
                    
                End Sub
                I hope this is helpful

                Nick

                Comment

                • tdw
                  New Member
                  • Mar 2007
                  • 206

                  #9
                  Originally posted by nspader
                  2 questions. These both pertain to the Access Options menu.

                  Under the General Tab is the Track auto name corrections checked? If so It shouldnt be. That will keep the Margins from defaulting to the PC's and will maintain the DB's margin settings.

                  Secondly, under the same tab do the margins's show the way you would want them to.

                  I found that this was a problem with my reporting. I would set the margins and the view (landscape or portrait) when designing and save it. But as soon as I close access and reopen it I would lose what I did.

                  A way that I used to ensure this wouldnt happen on a nother PC was to use a line of code in the swtichboard load option (or whatever form appears when the program is opened). I will place it below in case you want to try it.

                  Code:
                  Private Sub Form_Open(Cancel As Integer)
                  
                      Application.SetOption "Left Margin", 0.5
                      Application.SetOption "Right Margin", 0.5
                      Application.SetOption "Top Margin", 0.5
                      Application.SetOption "Bottom Margin", 0.5
                      Application.SetOption "Track Name AutoCorrect Info", False
                      
                  End Sub
                  I hope this is helpful

                  Nick
                  box is unchecked and margins are set right in that tab.

                  I tried similar code in the button that launches the report, but I will try it on the switchboard. Thanks!

                  Comment

                  Working...