Twips Secrets Sizing Forms Reports

This tip will divulge Twips Secrets Sizing Forms Reports

This tip is suitable for all versions of Microsoft Access, but see the light blue help boxes , for extra bits of info if you are using Microsoft Access 2007 or Microsoft Access 2010.

I do not know about you, but I have had considerable grief on setting the size of forms and reports. The windows seem to open up to whatever size they like. I usually get around this by Maximizing them, but there is another solution which is infinitely more flexible.

In this lesson we will cover Macros that will set the size of the form and report windows.

We will cover:

• Maximizing the form;

• The MoveSize action;

• And finally, TWIPs, just in case you want to know what they are.

Maximizing a Form or Report

To maximize a form or report:

  • Open the form/report in Design view;
  • Right click on the upper left hand corner of the form or reports window (where the two rulers meet), a black square will appear;
  • Select properties from the drop down list;
  • Click on the ‘Event’ tab;
  • Place your cursor next to the ‘On Open’ event (may need to scroll down to see it in 2007/10) and click on the button with the 3 dots (...) and select ‘Macro’, then ‘OK’;
  • Name the Macro and click on OK (if prompted);
  • Now, in the ‘Action’ column in the first row, click the arrow and select ‘Maximize’ from the drop down list;
  • Close and save the Macro. Note: Microsoft Access 2007/10, will automatically save this Macro as an embedded macro, therefore if you wish to use this Macro on other forms choose the 'Save As' option. (see help links at the end of this page for more info).

You can now add this macro to the ‘On Open’ event or one of the other related events for any form or report you wish to Maximize on opening.

The MoveSize Action

Maximizing a form or report might not give you the result you want, this is where the ‘MoveSize’ action comes in handy.

To set the ‘MoveSize’ action in a Macro:

  • Open the form or report in Design view;
  • Right click on the upper left hand corner of the form or reports window (where the two rulers meet), a black square will appear;
  • Select properties from the drop down list;
  • Click on the ‘Event’ tab;
  • Place your cursor next to the ‘On Open’ event (may need to scroll down to see it in 2007/10) and click on the button with the 3 dots (...) and select ‘Macro’, then ‘OK’;
  • Give the Macro an appropriate name then, click on ‘OK’ (if prompted);
  • Now, in the ‘Action’ column in the first row, click the arrow and select ‘MoveSize’ from the drop down list.

Unlike the ‘Maximize’ action you also have to select criteria as to where you wish the window to be positioned and what size you would like it.

So, at the bottom of the window set the four criteria:

  • Right – set the distance you wish the upper left hand corner of the form/report window to be from the edge of the left hand side of the screen (either in inches or cm);
  • Down - set the distance down you wish the upper left hand corner of the form/report window to be from the ruler (either in inches or cm);
  • Width – set the width you wish the window to be (either in inches or cm);
  • Height – and, finally, set the height.
  • Close and save the Macro. Note: Microsoft Access 2007/10, will automatically save this Macro as an embedded macro, therefore if you wish to use this Macro on other forms choose the 'Save As' option. (see Help links at the end of this page for more info).
  • You can now add this macro to the ‘On Open’ event or any other appropriate event for any form or report you wish to set the size of the window on opening.

    The ‘MoveSize’ action may need to be built and individualized for each individual form/report, if you want them to be different sizes. Keep this in mind when you are naming the Macro. In this case it maybe better if you are using Access 2007/10 to leave it as an embedded Macro.

    Twips/SetValue

    A form’s height and width can also be set using the 'SetValue' action of a macro.

    This is handy to know if you wish to change the size of a form from another form. The ‘MoveSize’ action can only be used for the current form or report. To do this:

    Follow the steps above, but choose ‘SetValue’ from the drop down list of the Macro.


    Help Box Trusted Locations If you add what Microsoft Access 2007 or 2010 classifies as an unsafe Macro such as 'SetValue' then you will need to add your database path to 'Trusted Locations', to learn how to do that, then Click Here You will also need to 'Show All Actions', if you need some help with this then Click Here.

    Then:

    • in the ‘Item’ section, choose the following using the button with the 3 dots (...);
    • Forms![Form1].InsideHeight (Where Form1 is the name of the form you wish to set)
    • Set the InsideHeight measurement in the ‘Expression’ box. The measurement of the inside height/width are in twips. What you need to know is that twips are very small. There are 567 twips in a centimetre.;
    • Select ‘SetValue’ again in the second row in the ‘Actions’ Column. This time select:
    • Forms![Form1].InsideWidth and set as per above

    Please Note: The InsideWidth and InsideHeight properties are only available for forms and not reports.


    Finished with Twips Secrets Sizing Forms Reports then Return to Microsoft Access Forms

    or


    Simply Access Home Page



    privacy policy