Article ID: 101067
Article Last Modified on 5/6/2003
APPLIES TO
- Microsoft Access 1.0 Standard Edition
- Microsoft Access 1.1 Standard Edition
- Microsoft Access 2.0 Standard Edition
This article was previously published under Q101067
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When choosing a command button, you may receive the following error message:
This error message occurs when you activate a macro from the OnPush property in version 1.x, or the OnClick property in version 2.0, of a command button on a form. The macro includes a SendKeys action (in which the keystrokes sent include the ESC key) and the Wait argument is set to Yes.
CAUSE
The Cancel property of the command button is set to Yes.
RESOLUTION
Change the Cancel property of the command button to No.
MORE INFORMATION
You receive the above error message if you choose a command button and all the following conditions are met:
- The macro attached to the command button includes a SendKeys action.
- The command button's Cancel property is set to Yes.
- You choose the command button by pressing ESC.
If the command button activates a macro that performs a SendKeys action, which in turn sends an ESC keystroke, the button that repeatedly activates the macro is chosen and an endless loop results. Note that if the Wait argument on the SendKeys action is set to No, Microsoft Access will appear to hang.
Steps to Reproduce Behavior
- Start Microsoft Access and open the sample database NWIND.MDB.
Create a new macro called Test Macro:
Test Macro Actions ------------------ SendKeys Keystrokes: {esc} Wait: Yes
- Open the Customers form in Design view.
Add a command button to the form:
Object: Command Button ---------------------- ControlName: Test Button Caption: Test Button OnPush: Test Macro (version 1.x) OnClick: Test Macro (version 2.0) Cancel: Yes
- Switch to Form view.
- Choose the Test button. The following error message appears:
Keywords: kbprb kbusage KB101067