• Maximize Form (Access 2007)

    Author
    Topic
    #447814

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1093144

      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!

      • #1093149

        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!

        • #1093164

          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

        • #1093221

          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.

          • #1093240

            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

    Viewing 0 reply threads
    Reply To: Maximize Form (Access 2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: