Mendip Data Systems

Database applications for businesses and schools


ResizeForm Me - A Tutorial in Automatic Form Resizing :     Part 3 (of 3)

In the first part of this article, I discussed the benefits of automatic form resizing as well as an alternative approach based on layout guides and anchoring.


In the second section, I showed how the resizing code can add an adjustable zoom feature in your forms. It also covered some potential issues together with possible solutions for each of these.


This final part of this article explains how the code works and provides tips for using the code most effectively in your own applications.



Colin Riddington      Mendip Data Systems        Updated 24/01/2020

* Required

To provide feedback on this article, please enter your name, e-mail address and company (optional) below, add your comment and press the submit button. Thanks

Difficulty level :   Moderate

Click any image to view a larger version


How Does the Code Work?

All the code used in the automatic form resizing process is conntained in the module modResizeForm.

The code works in both 32-bit and 64-bit versions of Access


No additional VBA references are required


There are a number of procedures used of which the following are the most important.


Firstly, the GetFactor function calculates the multiplying factor based on screen size & resolution:


The Resize procedure gives ‘special treatment’ to selected controls – list boxes, combo boxes and tab controls - to manage their individual features.


Tab control pages are excluded as are the contents of subforms (the subform container is resized automatically)


As previously stated, the code line ResizeForm Me needs to be added to each form being resized.

This code line means the ResizeForm procedure is applied to the loaded form (Me)


To scale up the subform control positions / sizes, add the line ResizeForm Me to the Form_Load event of the subform.

Alternatively, add a line like ReSizeForm subFormName.Form to the Form_Load event of the main form .... 


NOTE: DO NOT DO BOTH METHODS or the subform will be scaled up twice!!

The code first checks whether resizing is required then uses the Resize procedure above


Following that two adjustments may be made:

a) For popup forms an adjustment is made to the code to fix possible positioning issues. However this can be disabled by setting the form Tag value = 1


b) Where the display option is set to tabbed documents, the navigation pane is first maximised and then minimised again. This again fixes positioning issues




If you have a form that is sometimes used as a subform, you can conditionally apply resizing code when used as a standalone form.

Place the following code in the subform itself


Click any image to view a larger version

Return to Home Page Return to Access Articles 1 3 Return To Top
Page 3 of 3


If all the screens on which your application will be displayed are known to have the same form factor e.g. widescreen, you should set your default form

size/shape accordingly to match that


The Resize procedure then uses the GetFactor value to adjust the height and width of the form together with the size and position of each control 

on the form.


Very occasionally, you may experience a form that does not automatically revert to its correct size on closing.

In such cases, try adding the line UnresizeForm Me in the Form_Close event.

I also do this where conditional resizing code is applied to subforms (as above)



The new ZoomForm procedure is a modified version of the oriignal ResizeForm code.



The UnResizeForm procedure can be used to fix issues when forms become 'over-enlarged'.

This reverses the form resizing code and effectively 'shrinks' the form again



The UnResizeForm procedure can be used to fix issues when forms become over-enlarged.

This reverses the form resizing code and effectively 'shrinks' the form again.


It is used in both the frmFormUnresizer form and the FixFormSize procedure :

Several other procedures are also included in modResizeForm:


a)   GetScreenResolution / GetResolution / GetHorizontalResolution / GetVerticalResolution / GetScreenShape


b)   GetTopOffset / GetLeftOffset - used to centre forms on screen


c)    AdjustColumnWidths - used in Resize procedure to adjust combo boxes & list boxes during resizing


d)   GetOrigWindow - used to note the original form dimensions before resizing


e)   RestoreWindow - can be used in the Form_Close event to restore the original form dimensions


Additional code is used in the form being zoomed.

First of all the form is 'unresized' then resized by an additional amount based on the sngZoom multiplier


Adjustments are made to the form width and section heights to ensure it remains in proportion.

This is done by comparing with with the sizes of four hidden lines placed on each section of the form


Click the links to download various items related to this topic:


1.   The original auto form resize utility by Jamie (MDB zipped)


2.   The example application referenced in this article  - (ACCDB file zipped)


3.   The complete article as a PDF document – ResizeForm Me_v2.6.pdf (PDF zipped)



I would be grateful for any feedback on this article including details of any errors or omissions

If you have any comments or questions, please contact me using the feedback form below or by email