Microsoft KB Archive/132010

From BetaArchive Wiki

Article ID: 132010

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 Q132010

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

SYMPTOMS

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: kbprb KB132010