Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Pontiac, Michigan, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Maximize Form (Access 2007)

    How do I have a form open up Maximized in Access 2007? I just upgraded to 2007 from 2002 and the command I had been using doesn't work and Access 2007 doesn't it like.

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Maximize Form (Access 2007)

    You need to attach VBA Code (or a macro) to the forms On_Open event.

    If you switch the form into design view, and activate its properties window, click on the event tab.
    Locate the On Open event
    Click on the ellipse button and select Macro builder or Code Builder

    ~ If macro builder is selected, set up a macro with the action Maximize
    ~ If Code Builder is selected paste this code into the module:

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

    Save and close the form and when it opens next, time it will maximize!
    Regards,
    Rudi

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Pontiac, Michigan, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Maximize Form (Access 2007)

    Rudi, in my previous Access I had that command in OnActivate. 2007 didn't like it one bit

    Thank you for the code! I'll make good use of it.

    WOPR rocks!

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Maximize Form (Access 2007)

    Hi,

    I have moved the maximize command to the On_Activate event, and I too find that it does not react. If I am not mistaken, the activate event should trigger when I reselect (or activate) the form with another form currently active. This is unusual? Could someone else confirm this, or inform me if my logic is incorrect?

    TX
    Regards,
    Rudi

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Maximize Form (Access 2007)

    I am puzzled by this problem. I use docmd.maximize in the Onactivate event for forms all the time, and I have not had any problems migrating this to 2007.

    The Activate event occurs when a form becomes the active form. So if you open form A, then open form B in front of form A, close form B and return to form A, the Activate event for form A will occur again.

    I wonder if this is a security issue. Access 2007 treats all VBA as potentially suspicious, and does not allow it to run unless you explicitly give it permission. To avoid that you need to add the database to your trusted locations...Office..Access Options..Trust Centre..Trust Centre Settings..Trusted Locations..Add New Location.
    Regards
    John



  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Maximize Form (Access 2007)

    John and Peggy,

    The On_Activate event is working now, and I know what the problem was when it was not working.

    I opened a sample database and I set up two forms. On the one form I created the On_Activate event to maximize the form. After that I saved it and proceeded to open the second form in order to switch between the two to test the event. It did NOT fire! This is what raised suspicion and I posted Peggy back to say I too had a problem. This morning I re-opened the database to see if I could re-test the scenario, and found that the event was working perfectly. Since you mentioned about security issues, it dawned on me that I did not provide "permissions" to the newly created code when I created the database last night. This morning I opened it but enabled the VBA content by reacting to the security alert. The original On_Activate and subsequent event based test fired off perfectly!

    Cheers
    Regards,
    Rudi

Posting Permissions

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