PRA: DoCmd.Hourglass Ineffective When Navigating Records

    Article ID: Q138441
    Creation Date: 19-OCT-1995
    Revision Date: 01-DEC-1996

    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 code containing a DoCmd.Hourglass True statement (or DoCmd Hourglass True statement in version 2.0) is placed to run during record navigation (such as on OnCurrent, AfterUpdate, BeforeUpdate, and so on) the Hourglass statement fails when the built-in navigation buttons or a button with the AutoRepeat property set to True is used to move between records.

    CAUSE

    AutoRepeat buttons capture the mouse, and therefore handle all mouse and cursor interaction. The record navigation buttons are AutoRepeat buttons.

    RESOLUTION

    Use a command button with the AutoRepeat property set to False to navigate between records.

    STATUS

    Microsoft has confirmed this to be a problem in Microsoft Access 2.0, 7.0, and 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

    MORE INFORMATION

    Steps to Reproduce Problem

    1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0).
    2. Open the Categories form in Design view and add the following code to the OnCurrent property:

      In Microsoft Access 7.0 and 97:

            Private Sub Form_Current()
               Dim i As Integer
               DoCmd.Hourglass True
               For i = 1 To 1000
                  Debug.Print "Iteration " & i
               Next i
               DoCmd.Hourglass False
            End Sub
      

      In Microsoft Access 2.0:

            Sub Form_Current()
               Dim i As Integer
               DoCmd Hourglass True
               For i = 1 To 1000
                  Debug.Print "Iteration " & i
               Next i
               DoCmd Hourglass False
            End Sub
      
    3. View the form in Form view. Note the hourglass as the form opens.
    4. On the Edit menu (or Record menu in version 2.0), point to Go To, and then Next. Note that the hourglass appears as the record changes.
    5. Click the record navigation button at the bottom of the form to go to the next record. Note that the hourglass does not appear during processing of the Debug.Print statements.


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.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

KBCategory: kbprg
KBSubcategory: MdlProb
Additional reference words: 2.00 7.00 97 8.00 Pointer OnLostFocus OnEnter
OnExit
BeforeInsert AfterInsert