Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Form Maximize (Office 97 SR2)

    Hi

    Can anyone tell how to make a form open maximized. the form is set to open on startup but opens with the top halfway down the screen.

    Before you reply can you please bear in mind I am a bit of a novice!

    <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>
    If you are a fool at forty, you will always be a fool

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Maximize (Office 97 SR2)

    Open your form in design view.
    Activate the Properties window (if it's not open: View/Properties)
    In this window, click the Events tab.
    Click in the On Open event.
    From the drop down list, select Event Procedure.
    Click the Build button to the right of the event (the button with three dots ...).
    The class module for the form will open, with the framework for the OnOpen event:

    Private Sub Form_Open(Cancel As Integer)

    End Sub

    In the empty line between Sub ... and End Sub, type

    DoCmd.Maximize

    Close the module and the form (save it, of course), and test if it opens maximized. You may also want to restore to normal size when you close the form, because otherwise other objects will be maximized too: create an event procedure for the On Close event the same way you did for the On Open event, and type

    DoCmd.Restore

    HTH,
    Hans

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Form Maximize (Office 97 SR2)

    Check out <post#=216830>post 216830</post#>

    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Form Maximize (Office 97 SR2)

    Hi Hans

    Worked like a dream, I am in your debt once more.

    Big Thanks

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    If you are a fool at forty, you will always be a fool

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Form Maximize (Office 97 SR2)

    Hi

    Thanks for the response as I told Hans worked like a dream
    If you are a fool at forty, you will always be a fool

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Maximize (Office 97 SR2)

    Hi Hans

    I just looked at one of my major forms and noticed:

    Private Sub Form_Load()

    mlngRed = rgb(255, 0, 0)
    mlngBlack = rgb(0, 0, 0)
    mlngYellow = rgb(255, 255, 0)
    mlngWhite = rgb(255, 255, 255)
    mlngGreen = rgb(0, 128, 0)

    DoCmd.Maximize

    End Sub

    Things seem to be working OK

    Should I move DoCmd.Maximize to form Foem_Open?

    Thanks, John

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Form Maximize (Office 97 SR2)

    Form_Open happens earlier, that's all.
    Charlotte

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Maximize (Office 97 SR2)

    John,

    As Charlotte wrote, the OnOpen event occurs before the OnLoad event. It doesn't really matter in this case, but it might be useful to keep the differences in mind:
    <UL><LI>The OnOpen event has a Cancel argument that can be set to True to cancel opening the form; the OnLoad event can't be canceled.
    <LI>OnOpen is too early for some things - see for instance the thread starting at <post#=213729>post 213729</post#>, where it turned out that setting the value of a calendar control in the OnOpen event will be ignored; you must do it in the OnLoad event.[/list]Here is the complete sequence of events during the opening of a form (taken from the online help):

    Open* - Load - Resize - Activate - Current

    and during the closing of a form

    Unload* - Deactivate - Close

    The events marked with * can be canceled.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •