Creating a keyboard shortcut for a button

M

MusicMarth

I have a database with contact information. My main form has several buttons
(next record, new record, search, etc.). Is there any way I can create a
keyboard shortcut for, say, the search button so all I have to do is ctrl+s
or something like that?
 
R

Ricoy-Chicago

The following works for me:

In the command button caption type the "shortcut" letter inside & &. For
example:

&A&dd records

When you open the form the caption of the button will be displayed with the
A underlined.

Press [Alt] + [A] to run the shortcut.

These shortcuts will overcome the Windows Shortcuts.
Make sure not to sue the same letter as a shortcut. For example, don't have
another command button caption with an &A& in it.
 
M

Mr B

For a very simple solution, try placing an ampersand sigh "&" just prior to
the characte that you would like to have as a shortcut to the action of the
command button.

For example: if you have a button with a caption of: "My Test" and you want
the On Click action of this button to be executed with the press of a
combination of keys, just place the "&" character in front of the desired
character. This would need to be different for each button on the form. If
you place the "&" just before the "e" in Test then the caption on the button
will underline the "e" and you can press "Alt" plus "e" and the action of
that button will be run.
 
M

MusicMarth

Thank you so much!

Mr B said:
For a very simple solution, try placing an ampersand sigh "&" just prior to
the characte that you would like to have as a shortcut to the action of the
command button.

For example: if you have a button with a caption of: "My Test" and you want
the On Click action of this button to be executed with the press of a
combination of keys, just place the "&" character in front of the desired
character. This would need to be different for each button on the form. If
you place the "&" just before the "e" in Test then the caption on the button
will underline the "e" and you can press "Alt" plus "e" and the action of
that button will be run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top