ACC2000: SendKeys Macro Does Not Run (209624)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q209624
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

A macro that includes a SendKeys macro action does not run the SendKeys action.

CAUSE

If the Wait argument for the SendKeys action is not set to Yes, the macro action is run after some delay. Depending upon the following macro action, the keystrokes that are sent may not be valid. If the keystrokes are not valid, the SendKeys action appears not to have run.

RESOLUTION

Set the Wait argument for the SendKeys action to Yes.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access and open any database.
  2. Create the following macro:

    Action: SendKeys
    Keystrokes: %FX
    Wait: No

    Action: MsgBox
    Message: "HELLO WORLD"

  3. Save the macro as TestSendKeys.
  4. Run the TestSendKeys macro.

    The first macro action should quit Microsoft Access. However, the Wait argument is set to No and the message box is activated before the SendKeys action is run. When the keystrokes are processed, they are not valid, and you may hear beeping instead. If the Wait argument were set to Yes, the SendKeys action would have completed before moving to the next action, thus quitting Microsoft Access.

REFERENCES

For more information about the SendKeys action, click Microsoft Access Help on the Help menu, type sendkeys action in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbprb KB209624