Microsoft KB Archive/103251

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

PRB: Macro with Two SendKeys Actions Loops Infinitely

Article ID: Q103251
Creation Date: 19-AUG-1993
Revision Date: 01-DEC-1996 The information in this article applies to:

  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS


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

When you run a macro that includes two SendKeys actions, the macro enters an infinite loop and you must restart your computer to regain control.

CAUSE


When only one SendKeys action is used in a macro, you can stop the macro by pressing CTRL+BREAK and then choosing Halt. However, using a second SendKeys action toggles the default, or non-Single Step, macro mode so that you cannot terminate the macro without restarting your computer.

MORE INFORMATION


Steps to Reproduce Behavior


CAUTION: Save all work on your computer before you set up the example below. You will have to restart your computer after you run the sample macro.

  1. Open a database and create the following macro:

          Macro Name       Action
          -------------------------
          Go Loop          SendKeys
                           SendKeys
          Go Loop Actions
          ------------------
          SendKeys
             Keystrokes: " "
             Wait: No
          SendKeys
             Keystrokes: " "
             Wait: No
  2. Create a new, blank form in Design view.
  3. Add a command button to the form and set its OnClick property (or OnPush in version 1.x) to Go Loop.
  4. Switch to Form view, and then click the command button.

REFERENCES

For more information about the SendKeys action, search the Help Index for "SendKeys."



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: kbusage
KBSubcategory: McrActn
Additional reference words: 1.00 1.10 2.00 7.00 8.00 97 reboot hang