Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

You can use the SendKeys macro action in Access desktop databases to send keystrokes directly to Access or to an active Windows-based application.

Security Note: Avoid using the SendKeys statement or an AutoKeys macro with sensitive or confidential information. A malicious user could intercept the keystrokes and compromise the security of your computer and data.

Note: This action will not be allowed if the database is not trusted.


The SendKeys macro action has the following arguments.

Action argument



The keystrokes you want Access or the application to process. Enter the keystrokes in the Keystrokes box in the Action Arguments section of the macro design window. You can type up to 255 characters. This is a required argument.


Specifies whether the macro should pause until the keystrokes have been processed. Click Yes (to pause) or No (to not pause). The default is No.


Access processes the keystrokes it receives through the SendKeys macro action exactly as if you had typed them directly in an Access window.

To specify the keystrokes, use the same syntax as you would for the SendKeys statement.

Note: An error can occur if the Keystrokes argument contains incorrect syntax, misspelled text, or other values that aren't appropriate for the window the keystrokes are sent to.

You can use this macro action to enter information in a dialog box, particularly if you don't want to interrupt the macro to respond manually to the dialog box. Some Access macro actions, such as PrintOut and FindRecord, automatically select the options in certain frequently used dialog boxes. You can use the SendKeys macro action to select the options in less commonly used dialog boxes.

  • Because the dialog box suspends the macro, you must put the SendKeys macro action before the action that causes the dialog box to open and set the Wait argument to No.

  • The timing of the keystrokes reaching Access or another application can be tricky. As a result, it's recommended that if there's some other method (such as the FindRecord macro action) you can use to achieve a desired task, use that method rather than using the SendKeys macro action to fill in the options in a dialog box.

If you want to send more than 255 characters to Access or another Windows-based application, you can use several SendKeys macro actions in succession in a macro.

Using the SendKeys macro action to send keystrokes triggers the appropriate KeyDown, KeyUp, and KeyPress events. Sending non-ANSI keystrokes (such as a function key) doesn't trigger the KeyPress event.

This action isn't available from a Visual Basic for Applications (VBA) module. Use the SendKeys statement instead.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!