ACC: "Out of Stack Memory" Error Message with SendKeys Macro

ID: Q101067


The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0


SYMPTOMS

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

When choosing a command button, you may receive the following error message:

Not enough stack memory left

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


  1. Start Microsoft Access and open the sample database NWIND.MDB.


  2. Create a new macro called Test Macro:
    
          Test Macro Actions
          ------------------
          SendKeys
             Keystrokes: {esc}
             Wait: Yes 


  3. Open the Customers form in Design view.


  4. 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 


  5. Switch to Form view.


  6. Choose the Test button. The following error message appears:
    Not enough stack memory left


Keywords : kbusage McrArg
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: March 24, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.