Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Resize Event Fires Unexpectedly When Changing Form Focus


View products that this article applies to.

This article was previously published under Q208358
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Symptoms

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

↑ Back to the top


Cause

When the form that is losing focus is in a maximized state and you are changing focus to another maximized object, the form's Resize event occurs. 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.

↑ Back to the top


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 uses the Resize event of a form.

Steps to Reproduce Behavior

  1. Create a new database called Resize.mdb.
  2. Create the following form:
    Name: 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 then close it.
  5. Open the form in Form view; you receive the following message:
    The Resize Event Fired for Test1
    Click OK.
  6. Press F11 to bring the Database window into focus, and then maximize the Database window.
  7. On the Window menu, click 2 TestForm to bring the Test1 form into focus. You receive the following message:
    The Resize Event Fired for Test1
    Click OK.
  8. On the Window menu, click 1 Resize: Database to bring the main database window into focus. You receive the following message again:
    The Resize Event Fired for Test1
    This occurs because Access is restoring the form to a windowed state as it places it behind the main database window.

↑ Back to the top


References

For additional information about the behavior of maximized forms in Microsoft Access, click the article number below to view the article in the Microsoft Knowledge Base:
210123� ACC2000: Maximizing One Form Maximizes All Forms
For additional information about using custom form properties to expose the Maximize and Minimize status of forms, click the article number below to view the article in the Microsoft Knowledge Base:
210190� ACC2000: How to Determine If a Form Is Maximized or Minimized

↑ Back to the top


Keywords: KB208358, kbprb

↑ Back to the top

Article Info
Article ID : 208358
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 327