Run an Access macro by using a keyboard shortcut

You can assign an action or set of actions to a specific key or keyboard shortcut by creating an AutoKeys macro group. When you press the key or keyboard shortcut, Microsoft Office Access performs the action.

Note: If you assign an action to a keyboard shortcut that is already assigned to Access, the action that you assign to this keyboard shortcut replaces the Access key assignment. For example, CTRL+C is the keyboard shortcut for the Copy command; if you assign this keyboard shortcut to a macro, Access will run the macro instead of the Copy command.

Create the AutoKeys macro

  1. On the Create tab, in the Other group, click Macro. If this command is unavailable, click the arrow beneath either the Module or the Class Module button, and then click Macro.

  2. On the Design tab, in the Show/Hide group, click Macro Names to display the Macro Name column.

  3. In the Macro Name column, press the key or keyboard shortcut to which you want to assign the action or set of actions.

  4. In the Action column, add the action that you want the key or keyboard shortcut to perform. For example, you can add a RunMacro action that runs the Print Current Record macro when CTRL+P is pressed.

    AutoKeys macro containing PrintRecord macro action

    To assign more than one action to the keyboard shortcut, add the additional actions that you want below the first action. Leave the Macro Name column blank for each succeeding action.

  5. Repeat steps 3 and 4 for any other key assignments that you want to make.

  6. Click the Microsoft Office Button Office button image and then click Save, or press CTRL+S.

  7. In the Save As dialog box, under Macro Name, type AutoKeys.

The new key assignments are available as soon as you save the macro group, and are in effect every time that you open the database. If you want, you can bypass the key assignments (and many other startup options) by holding down the SHIFT key while you start the database.

Find links to more information about creating macros in the See Also section.

Important: If the database is not granted trusted status, certain macro actions are disabled. You can enable all macro actions by clicking Options in the message bar, and then selecting Enable this content. This enables all macro actions until you close the database. For more information about permanently granting trusted status to a database, see the links in the See Also section of this article.

Syntax for AutoKeys keyboard shortcuts

The following table shows some example keyboard shortcuts that you can enter in the Macro Name column to make key assignments in an AutoKeys macro group. These keyboard shortcuts are a subset of the syntax that is used in the SendKeys statement in Microsoft Visual Basic.

Macro Name

Key or keyboard shortcut

^A or ^4

CTRL+A or CTRL+4

{F1}

F1

^{F1}

CTRL+F1

+{F1}

SHIFT+F1

{INSERT}

INSERT

^{INSERT}

CTRL+INSERT

+{INSERT}

SHIFT+INSERT

{DELETE} or {DEL}

DELETE

^{DELETE} or ^{DEL}

CTRL+DELETE

+{DELETE} or +{DEL}

SHIFT+DELETE

Top of Page

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×