From the course: Access 2021: Tips, Tricks, and Techniques

Add customized shortcut keys

- [Instructor] Power users of any system love having shortcuts to getting their work done. The users of your database will be no exception and once they've gotten used to the workflows that you've set up for them, they might appreciate even faster and more efficient ways to accomplish common tasks. We can provide multiple ways of accomplishing something in the database by providing power users with keyboard shortcuts that activate button controls. This can make navigating around the database even faster. I'd like to add customized shortcuts to the three buttons here at the top of the Main Menu. To do that, let's go into Design View. Then I'll select the Enter a New Customer button. And in the Property Sheet, we'll switch over to the Format tab. Here, we'll find the Caption property, and this just lists out the text that appears on the button. In order to add a keyboard shortcut to this button, we just need to identify a letter that we want to use to activate the button. For the Enter a New Customer button, I'll use the letter C. In order to at the keyboard shortcut, in the text here of the caption, I'll click my mouse right before the letter C in Customer and type an ampersand character. That's shift-7 on your standard U.S. keyboard. When I press Enter, you'll notice that the button text over here on the button actually updates to have an underline underneath the letter C. That's the indication that the letter C is the keyboard shortcut for that button now. Let's also add keyboard shortcuts to the other two buttons. For the View Product Listing button, I'll use the letter P as a shortcut key, and to do that, I'll type an ampersand before the P in Product Listing. For the Review Customer Orders button, I'll use the O in orders as the keyboard shortcut. So now I have keyboard shortcuts for all three of these buttons. Let's save the design of the form and then we can test it out. In order to activate the Review Customer Orders button, I'll press alt-O on my keyboard and it jumps me right to that form. I'll press the Return to Main Menu button to take us back. Now I can press alt-P to open up the product listing and there it is, and return to the Main Menu. Alt-C will open up the Customer Data Entry form, and I can press Return to Main Menu to go right back to where we started. Now, there's two additional properties that we could take a look at that have similar functionality. Let's go into the Product Listing and we'll take a look. I'll take this form into Design View. Then, I'll scroll over to the right to find the Return to Main Menu button and click it to activate it. On the Other tab of the Property Sheet for a button, we have two additional properties that I want to see, the Default property and the Cancel property, and they both default to No. The Default property will activate a button when you press the Enter key on your keyboard. The Cancel property will set up a button to be activated when you press Escape on your keyboard. Now each form can only have a single button that's set to Default or Cancel. You can't have multiple buttons that are Default or Cancel. For the Return to Main Menu button, I want to be able to activate this by pressing Escape on the keyboard, so I'll change the Cancel property to Yes. We can also add a keyboard shortcut to the letter M by going to the Format tab and right before Main Menu, I'll type in an ampersand before the letter M. So now I'll have two different keyboard shortcuts that'll activate the same button. Let's go ahead and press Enter. I'll save the design of this form and we'll go into Form View. So now I can press alt-M, which will activate the button. If I go back into the Product Listing and press the Escape key on my keyboard, it does the same thing. So that's how we can activate our button controls using keyboard shortcuts. Simply place an ampersand character before the letter that you want to use in the button's caption and you've instantly provided a secondary and more efficient way of activating the action. Alternatively, enable the Default or Cancel properties to make the buttons respond to either the Enter or the Escape keys on your keyboard.

Contents