ACC: MoveSize Action Does Not Position Form at Top of Screen

Last reviewed: May 30, 1997
Article ID: Q132010
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 use the MoveSize action to position a form at the top of the screen after hiding the form's toolbar with the ShowToolbar action, there is a gap between the menu bar and the top of the form equal in size to the hidden toolbar.

CAUSE

The MoveSize action is triggered before the ShowToolbar action can fully hide the toolbar.

RESOLUTION

To work around this behavior, use one of the following methods:

Method 1 (All versions)

Set the form's OnActivate property to the following event procedure:

   Private Sub Form_Activate()
      ' In version 2.0, the DoCmd is written DoCmd <command>
      Me.TimerInterval=500
      DoCmd.ShowToolbar "Form View", A_TOOLBAR_NO
   End Sub

Set the form's OnTimer property to the following event procedure:

   Private Sub Form_Timer()
      ' In version 2.0, the DoCmd is written DoCmd <command>
      DoCmd.MoveSize 0, 0
      Me.TimerInterval=0
   End Sub

Method 2 (Versions 2.0 and 7.0 only)

Set the form's OnActivate property to the following event procedure:

   Private Sub Form_Activate()
      ' In version 2.0, the DoCmd is written DoCmd <command>
      Application.SetOption "Built-In Toolbars Available", False
      DoEvents
      Application.SetOption "Built-In Toolbars Available", True
      DoCmd.ShowToolbar "Form View", A_TOOLBAR_NO
      DoCmd.MoveSize 0, 0
   End Sub

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0).

  2. Open the Customers form in Design view.

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

          Private Sub Form_Activate()
    
            ' In version 2.0, the DoCmd is written DoCmd <command>
            DoCmd.ShowToolbar "Form View", A_TOOLBAR_NO 'Hide Form view toolbar
            DoCmd.MoveSize 0, 0  ' Position the form at the top of the screen.
          End Sub
    
    

  4. Close and save the form.

  5. Open the form in Form view. Note that the toolbar is hidden, but the MoveSize action does not place the form immediately under the menu bar. There is a gap between the menu bar and the top of the form's window where the Form view toolbar was located.

REFERENCES

For more information about SetOption, search for "SetOption" using the Microsoft Access Help Index.


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


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 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.