Microsoft KB Archive/155135

= ACC: Resize Event Occurs When Changing Form Focus =

Article ID: 155135

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q155135



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



SYMPTOMS
When you switch the focus away from a form in a Microsoft Access database, the Resize event occurs 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 occurs 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
 Create a new database called Resize.mdb.  Create the following form:      Form: Test1 -     Caption: TestForm   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  Save the form as Test1 and close it.  Open the form in Form View and note that the following message box appears: <pre class="fixed_text">     The Resize Event Fired for Test1 </li> Press F11 to bring the database window into focus, then maximize the database window.</li>  On the Window menu, click 2 TestForm to bring the Test1 form into focus. Notice that the following message box appears: <pre class="fixed_text">     The Resize Event Fired for Test1 </li>  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:

<pre class="fixed_text">     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. </li></ol>

<div class="references_section">