ACC: No AutoRepeat with GoToRecord/Next and DoMenuItem

Last reviewed: May 28, 1997
Article ID: Q95645
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

The AutoRepeat property for command buttons does not work in conjunction with the GoToRecord/Next macro action for moving to successive records on a form. In other words, if your form uses command buttons instead of the record selector buttons to move from record to record, the AutoRepeat property does not repeatedly run a macro that performs a GoToRecord/Next action.

Also, the AutoRepeat property fails under the same circumstances when you use the DoMenuItem/Form/Records/GoTo/Next macro action. To rerun the macro, you must click the command button again.

CAUSE

This is correct behavior for these macro actions. Here are two points that need clarification before the cause can be explained:

  • OnClick property: The macro under the OnClick property of a command button normally will not run until you push and let up the command button with the mouse pointer in the command button's region. The exception is when the command button's AutoRepeat property is set to Yes. In this case, the macro set for the OnClick property of the command button runs when the button is pushed and the mouse pointer is in the command button's region.

    NOTE: The OnClick property is called the OnPush property in version 1.x.

  • Focus: Several macro actions change the focus. For example, GoToControl, GoToRecord, OpenForm, OpenTable, and ApplyFilter change the focus.

    Therefore, if a command button's OnClick property macro changes the focus, for example, to the next record, then the command button has lost the focus; that is, when you click the command button, the click does not apply to that command button anymore because the focus has changed. It's as if you had moved the mouse pointer off the command button while pressing the mouse button, as if the command button moved out from under the mouse pointer right before you pressed the mouse button.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access.

  2. Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).

  3. Create a new macro as follows and save it as AutoRepeatTest:

           Macro Name      Action
           --------------------------
           AutoRepeatTest  GotoRecord
    
           AutoRepeatTest Actions
           --------------------------
           GoToRecord
              Object Type:  Form
              Object Name:  Customers
              Record:       Next
    
    

  4. Open the Customers form in Design view.

  5. Drag the macro you have just created onto the form to create a command button.

  6. Set the AutoRepeat property of the command button to Yes. Note that the command button's OnClick property is set to the name of the macro.

  7. View the Customers form in Form view to browse the form and click the command button. Note that each time you click the command button, the record selector moves to the next record. When you click and hold down the command button, you would expect Microsoft Access to scroll rapidly to the last record in the table, but this does not happen. Instead, the record selector moves to the next record only, regardless of the command button's AutoRepeat property setting.

    However, if you add a macro that uses a different macro action, such as Beep, to the form, the AutoRepeat action works as expected. This is because Beep does not change the focus.


Keywords : kbusage McrActn
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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