Creating A Macro to Format an Access Report Margins

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Martian7
    New Member
    • Aug 2007
    • 4

    Creating A Macro to Format an Access Report Margins

    Hello,

    I have been having a problem with my database lately. Everything seems to be working well accept the reports. Everytime I open the report I have to reformat the report margins to get everything to fit on one page. I was wondering first if it is even possible to create an access macro or a combination of a macro and a module to run a format on the report when on the time the report opens so that I can view everything on one page. I want to set all of the page margins to .5" all around. Please let me know if you can help me. Thanks.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Don't need any code! In your menu goto
    Tools - Options - General and set Print Margins to whatever you want!

    Welcome to TheScripts!

    Linq ;0)>

    Comment

    • Martian7
      New Member
      • Aug 2007
      • 4

      #3
      Originally posted by missinglinq
      Don't need any code! In your menu goto
      Tools - Options - General and set Print Margins to whatever you want!

      Welcome to TheScripts!

      Linq ;0)>

      I have already tried this, but Each time I exit the Program, I have to reset the parameters.. That is why I thought may be some kind of a macro so that on entry of the report It would automatically set the margins for me... Please let me know if this makes sense. Thanks.

      Comment

      • dima69
        Recognized Expert New Member
        • Sep 2006
        • 181

        #4
        Originally posted by Martian7
        I have already tried this, but Each time I exit the Program, I have to reset the parameters.. That is why I thought may be some kind of a macro so that on entry of the report It would automatically set the margins for me... Please let me know if this makes sense. Thanks.
        Report margins have a nasty habit to get reset to defaults when the original definitions are incompatible with the default printer page definitions. There is no simple way to set report margins by VB code, and I am afraid this will not help in your case. I would advise you to just find the optimal margins the printer can accept.

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I think dima69 is exactly right. If you attempt to set the margins to something your default printer won't accept they do, I think, revert to Access' defaults. Access can't force a printer to do something it's not designed to do. About 99.9% of all Access/Printer problems are really printer problems. You might go to the site for the printer's manufacturer and see if they have updated drivers available for your printer. This will often cure this kind of problem.

          Linq ;0)>

          Comment

          • Martian7
            New Member
            • Aug 2007
            • 4

            #6
            I am just learning about Macros.. I thought the idea of a macro was to take certain actions and automate them. All I want to do is when someone looks at the set of reports they don't have the reports shoot out on two pages instead of one. I know this is possible in Word or Excel to create a macro to run in which you just run the macro and it sets your viewing screen to those certain margins in order to view everything on one page. Maybe I am explaining this wrong...I know when you go to the Page set up in Access it only has the basic margins of Top, Bottom, and Side margins, which is different than that of Word. It just seems like there should be a way to setup a macro that would open the "file" tab on the tool bar and open the "page setup" option and then somesort of a command to automate setting the margins to certain parameters. Am I thinking of something that is "IMPOSSIBLE " for Access? Or has it just not been discovered yet? Please let me know if this sounds "Logical" Thanks for all of your advice... I know I may be talking the issue blue in the face, but it just seems to be logically possible.

            Comment

            • dima69
              Recognized Expert New Member
              • Sep 2006
              • 181

              #7
              Originally posted by Martian7
              I am just learning about Macros.. I thought the idea of a macro was to take certain actions and automate them. All I want to do is when someone looks at the set of reports they don't have the reports shoot out on two pages instead of one. I know this is possible in Word or Excel to create a macro to run in which you just run the macro and it sets your viewing screen to those certain margins in order to view everything on one page. Maybe I am explaining this wrong...I know when you go to the Page set up in Access it only has the basic margins of Top, Bottom, and Side margins, which is different than that of Word. It just seems like there should be a way to setup a macro that would open the "file" tab on the tool bar and open the "page setup" option and then somesort of a command to automate setting the margins to certain parameters. Am I thinking of something that is "IMPOSSIBLE " for Access? Or has it just not been discovered yet? Please let me know if this sounds "Logical" Thanks for all of your advice... I know I may be talking the issue blue in the face, but it just seems to be logically possible.
              In Access, like in Word, you design the report to the specific, fixed page size (unless you create a dynamic report, which is the whole different thing). This is not like in Excel, where you can just fit everithing to one page. So I don't see a point in runing the script to reset report margins dynamically, while you can do the same thing in design view.

              Comment

              • NCRStinks
                New Member
                • Jul 2007
                • 45

                #8
                Not sure there's any need for a macro for this one.

                In Access 2003, if you go Tools --> Options you can set the report margins and this is saved for the whole database.

                I had the same problem where I had to re-set the margins for the report every time i reopened the database.

                Hope that helps!

                Dan

                Comment

                • Martian7
                  New Member
                  • Aug 2007
                  • 4

                  #9
                  Okay Guys,

                  Dan said that he had experienced the same problem with having issues opening the reports and his margins having changed once he closed and reopened access. So let me get this straight say I have certain reports that have to be at a margin of 1.25" all around, some that would fit all on one page if I had a .5" margin all around, and then others that needed specific margins of 1.5 margins all around to look right on "One" page. You all have been talking about the default margins in Access. My question is though... can I set different defaults based on the particular Access File I am working with, or do I just have the one "Default" Setting and have to change the margins based on each individual access File when I go to view the reports. I hope this makes sense. It is just confusing when I open different reports and then go back to my certain set of reports that have to abide by the .5" margin. When I go back to that set of reports the margins seemed to have changed them selves. Maybe I just didn't save each one in the design view to have that certain Page Setup. I guess what I am wondering is Can I set up my reports so that each time I or anyone else opens them they see what I want them to see all on "ONE" Page? There I did it, I think I have finally explained what I really am trying to do.. Please let me know if Ya'll can help me.. THANX/

                  Comment

                  • barry07
                    New Member
                    • Jan 2007
                    • 47

                    #10
                    You can set different margins for each report, and provided they are not outside the printer capability there should be no problem.

                    When you have the report open in Design View select File>Page Setup.
                    Set your margins and save the report. (Note you must EXPLICITLY save the report. If you just close it your settings may not be saved.)

                    If you know what printer your end-user is using it's worth installing that temporarily as your default printer and looking at your report in Print Preview. The printer doesn't have to be physically present for that to work.

                    Comment

                    Working...