709-218-7927

The Landfall Garden House

60 Canon Bayley Road

Bonavista, Newfoundland

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

Maximizing the Form at Startup

You may have noticed that each time your form loads, you need to double-click in the title bar to maximize the viewing area. "If it's boring and repetitive, write a macro" applies.

This will be a short command, "DoCmd.Maximize" associated with the entire form, rather than with any one control.

The easiest way (I know) of getting to code for the entire form is to close the form, all the way back to your database window, then select the form and choose the Design command button.

Choose View properties, to display the Properties window if it isn't already visible, and in the event tab, scroll down until you can see the "On open" event. This is the event that takes place when the form is opened for use (by you, the users).

Click the triple-dot button to create a code skeleton. You will find yourself in your VBA code module with this skeleton:

Private Sub Form_Open(Cancel As Integer)
End Sub

Include our line of code:

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
End Sub

Now close the form, saving changes, and re-open it. You user form should appear maximized!

709-218-7927 CPRGreaves@gmail.com

Bonavista, Sunday, December 08, 2024 9:30 AM

Copyright © 1990-2024 Chris Greaves. All Rights Reserved.