Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Run an Access macro by using a keyboard shortcut
 

You can assign an action (action: The basic building block of a macro; a self-contained instruction that can be combined with other actions to automate tasks. This is sometimes called a command in other macro languages.) or set of actions to a specific key or keyboard shortcut by creating an AutoKeys macro group (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.). 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 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 (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.). These keyboard shortcuts are a subset of the syntax that is used in the SendKeys statement in Microsoft Visual Basic (Microsoft Visual Basic: A high-level, visual-programming version of Basic. Visual Basic was developed by Microsoft for building Windows-based applications.).

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 Top of Page

© 2009 Microsoft Corporation. All rights reserved.