Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

You can assign an action or set of actions to a specific key or keyboard shortcut by creating an AutoKeys macro group with submacros for each keyboard shortcut you want to create. 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 with submacros

  1. On the Create tab, in the Macros & Code group, click Macro.

  2. In the Add New Action drop-down list select Submacro.

  3. In the submacro name box, enter the key or keyboard shortcut to which you want to assign the action or set of actions. The syntax to use for the keyboard shortcuts are shown in the table at the end of this help article.

  4. In the Add New Action drop-down list within the submacro block, select the action that you want the key or keyboard shortcut to perform. For example, you can add a Beep action that will cause Access to run the Beep macro action when CTRL+B is pressed.

    Three submacros in an Access macro called AutoKeys

    To assign more than one action to the keyboard shortcut, add the additional actions that you want below the first action, but still inside the same submacro block.

  5. To create other key assignments, you must create additional submacros for each key assignment and select actions inside each submacro block using the Add New Action drop-down list. In the screenshot above, you can see three separate key assignments defined with three separate submacros.

  6. Repeat steps 2 through 5 for any other key assignments that you want to make.

  7. Click Save, or press CTRL+S.

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

The new key assignments are available as soon as you save the AutoKeys 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.

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.

Syntax for AutoKeys keyboard shortcuts

The following table shows some example keyboard shortcuts that you can enter in the submacro name box 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.

Submacro 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

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.