ACC2: How to Dynamically Size Forms to Fit Screen Resolution

Article translations Article translations
Article ID: 138901 - View products that this article applies to.
This article was previously published under Q138901
Moderate: Requires basic macro, coding, and interoperability skills.
Expand all | Collapse all

On This Page


Microsoft Access provides no built in support to scale a form's size to match the current screen resolution. A form that you design on a computer with a video driver resolution of 1024x768 (Super VGA) may appear too large on computers running at 640x480 (VGA) resolution. A form that you design using 640x480 resolution may appear too small on computers running at 1024x768 resolution.

The following information describes where you can obtain two Access Basic functions, glrScaleForm() and glrResizeForm(), that you can use to dynamically scale and size a form. The glrScaleForm() function can be called from the Open event of your form to scale the size of a form to the current screen resolution when the form loads. The glrResizeForm() can be called from the Resize event of the form to automatically move and size the contents of a form proportionally to fit the new dimensions of the form window.



The glrScaleForm() function can be called from the Open event of your form to automatically scale the form to the current screen resolution.

      Function glrScaleForm (frm As Form, intX As Integer, intY As Integer)

      frm:  form to be scaled
      intX: horizontal resolution at which the form was designed
      intY: vertical resolution at which the form was designed


      Sub Form_Open (Cancel As Integer)
         Dim RetVal
         RetVal = glrScaleForm(Me, 1024, 768)
      End Sub


The glrResizeForm() function can be called from the Resize event of your form to automatically move and resize the contents proportionally to fit within the new form window size.

      Function glrResizeForm (frm As Form, fDoResize As Variant)

      frm:       form to resized
      fDoResize: boolean value indicating if the form should be resized or
                 the information tracked


      Sub Form_Resize ()
         Dim RetVal
         RetVal = glrResizeForm(Me, True)
      End Sub

How To Obtain The glrScaleForm And glrResizeForm Functions

The glrScaleForm() and glrResizeForm() functions, written by Ken Getz, are published in the following book:
   Microsoft Access 2 Developer's Handbook. Ken Getz, Paul Litwin,
   Greg Reddick. Sybex: 1994 ISBN: 0-7821-1327-3

Discussion of these function begins on page 506, chapter 8, "Screen Resolution and Distributing Forms." The functions are included in the file _Glrfile.exe on the accompanying companion disk. This self-extracting, compressed file contains the file _Chapter.exe, another self-extracting, compressed file, which contains the database CH8.mdb. The form frmTest1280x1024 in CH8.mdb demonstrates the use of these functions. Check the "Enable Automatic Resizing?" check box in the upper-left corner of the form frmTest1280x1024, and then resize the form window to see the glrResizeForm() function work.

These functions were originally published with a column in Smart Access magazine.
   "Create Resolution-Independent Forms in Access 2.0" by Ken Getz
   Smart Access, June 1994

Smart Access, published monthly, is a newsletter aimed at Microsoft Access developers. It is published by Pinnacle Publishing.
   Pinnacle Publishing, Inc.
   18000 72nd Ave South, Suite 217
   Kent, WA 98032

The products discussed here are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.


Article ID: 138901 - Last Review: July 5, 2002 - Revision: 1.0
  • Microsoft Access 2.0 Standard Edition
kb3rdparty kbhowto KB138901
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from