ACC: Resize Event Fires When Changing Form Focus

Last reviewed: May 12, 1997
Article ID: Q155135
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you switch the focus away from a form in a Microsoft Access database, the Resize event fires unexpectedly for the form losing focus.

CAUSE

The form losing focus is maximized and you are changing focus to another maximized object. All multiple-document interface (MDI) objects that do not have focus are automatically restored to a windowed state behind the maximized MDI form that has focus. When the current form loses focus, Windows automatically restores it to a windowed state, causing the Resize event to occur.

STATUS

The Windows MDI behavior is by design.

MORE INFORMATION

The Resize event of a form fires whenever a change occurs that affects the size of a form:

  • When you first open a form
  • When you resize a form using the keyboard or mouse
  • When you maximize a form
  • When you minimize a form
  • When you switch focus away from a maximized form

Switching focus away from a maximized form is an additional issue that you must consider when developing custom code that utilizes the Resize event of a form.

Steps to Reproduce Behavior

  1. Create a new database called Resize.mdb.

  2. Create the following form:

          Form: Test1
          -----------------
          Caption: TestForm
    

  3. Set the form's OnResize property to the following event procedure:

          Private Sub Form_Resize()
    
             MsgBox "The Resize Event Fired for " & Me.Name
          End Sub
    
    

  4. Save the form as Test1 and close it.

  5. Open the form in Form View and note that the following message box appears:

          The Resize Event Fired for Test1
    

  6. Press F11 to bring the database window into focus, then maximize the database window.

  7. On the Window menu, click 2 TestForm to bring the Test1 form into focus. Notice that the following message box appears:

          The Resize Event Fired for Test1
    

  8. On the Window menu, click 1 Resize: Database (or 1 Database: Resize in version 2.0) to bring the main database window into focus. Notice that the following message box appears:

          The Resize Event Fired for Test1
    

    This occurs because Access is actually restoring the form to a windowed state as it places it behind the main database window.

REFERENCES

For more information about the behavior of maximized forms in Microsoft Access, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q147152
   TITLE:      ACC: Maximizing One Form Maximizes All Forms (7.0/97)

   ARTICLE-ID: Q121410
   TITLE:      ACC: Maximizing One Form Maximizes All Forms

For more information about using custom form properties to expose the Maximize and Minimize status of forms in Microsoft Access 7.0 and 97 please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q141111
   TITLE:      ACC: How to Determine If a Form Is Maximized or Minimized
 

	
	


Keywords : FmsProb kbusage
Version : 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.