Question

Say I have a form on which a number of buttons exist. Everything works as it should when the buttons are clicked. How do I go about assigning keyboard shortcuts to my buttons so that Alt+A runs the action of Button A, Alt+B runs the action of button B etc.

seems like this would be trivial to do but I've not been able to see where I can set this.

Was it helpful?

Solution

When creating the button use the ampersand before the letter you want to Alt+? in the Caption property.

Examples:

&File ---> File

&Edit ---> Edit

F&orge --> Forge

E&nough -> Enough

OTHER TIPS

If you wanted to set up a Global Keyborad Shortcut that would work no matter where you are in the current database then you can create a special macro called AutoKeys and set up like the following:

alt text

Note the special character used to represent special keys:

^ for Ctrl
+ for Shift
% for Alt

{F11} represents the F11 (function) Key

If you want to add Function keys as shortcut to the forms, Add the below code to your form VB Code.

Need to set KeyPreview to Yes in order to work (see image below)

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyF5
        'Process F5 key events.
           Msgbox "F5"
        Case vbKeyF4
        ' Process F4 key events.
           MsgBox "F4"
        Case Else
    End Select
End Sub

Set Key Preview

Don’t Type When Access Does it For You

[Ctrl]+[;] inserts the current date. This is invaluable if you keep historical records, or include the date in any notes or other fields in your database. It not only saves time, but ensures data accuracy and keeps you from having to remember the date.

[Ctrl]+[:] inserts the current time. Like the Insert Date shortcut, this feature can save more time than you realize, and it also helps to keep your data accurate.

[Ctrl]+['] inserts the value from the same field in the previous record. When you need to enter several records consecutively, you probably find that many of the fields are the same from record to record. Using the clipboard to copy data can help, but you may need to enter several fields of duplicate information (your name in one field, the date in another field, and some generic comments in a third). Use this shortcut to insert the same field’s value from the previous record.

[Ctrl]+[Alt]+[Spacebar] inserts the default value for the current field. This comes in handy when you start typing, and then realize that you should have kept the default.

Don’t Use the Mouse When You Can Use the Keyboard

[Ctrl]+Arrow key combinations speed up navigation

[Ctrl]+[Left/Right Arrow] moves you to the beginning of the last/next word.

[Ctrl]+[Up/Down Arrow] moves you to the beginning of the last/next paragraph.

[Shift] +Arrow key combinations select text

[Shift]+[Left/Right Arrow] selects one letter.

[Shift]+[Up/Down Arrow] selects one line.

[Ctrl]+ [Shift]+[Left/Right Arrow] selects a word.

`[Ctrl]+ [Shift]+[Up/Down Arrow] selects a paragraph.

[F2] switches between Edit mode and Navigation mode Edit mode displays the insertion point. Navigation mode hides the insertion point, and selects the entire field. When in Navigation mode, use the arrow keys to move between fields.

[F4] opens a combo box or list box Use this keyboard shortcut to drop down the list, and then use the arrow keys to select a value from the list.

[Ctrl]+[+] adds a new record

[Ctrl]+[-] deletes the current record

[Shift]+[Enter] saves the current record Switching records also saves the data, but it’s a good idea to save frequently, especially if you’re entering a lot of data.

[Ctrl]+[PgUp] goes to the previous record

[Ctrl]+[PgDn] goes to the next record

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top