ACC: Resize Event Fires When Changing Form Focus
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 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:
The Resize Event Fired for Test1
- Press F11 to bring the database window into focus, then maximize the
database window.
- 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
- 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:
Q147152 ACC: Maximizing One Form Maximizes All Forms (7.0/97)
Q121410 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:
Q141111 ACC: How to Determine If a Form Is Maximized or Minimized
Keywords : FmsProb
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbprb