How to add keyboard shortcut to btn commant?

crododo

Registered User.
Local time
Yesterday, 23:57
Joined
May 2, 2013
Messages
27
Hi,
I am using access 2010 and I created couple of buttons on my forms that do some stuff in vba, but beside triger them with mouse I would also like my users to be able to have shortcuts on keyboard so for example I have btnClose an I widh when user press ALT + that btnClose do the same thing as it is doing when you press mouse on it
Thanks for help
 
I would look at using the form On Key events.

You will need to trap the value of the keys pressed, determine if this is one to trigger a button event then call the button event
 
Try adding an ampersand sign (&) in front of the character in the Caption of the button you want your use to cause the on click event of the button to fire. For example if you have a command button with the caption of "Close", and you want users to use Alt + c to activate the On Click event of that button, put the & in front of the "C". The caption property would be: &Close Users can now hold the Alt key and press the "c" key to run the code in the On Click event of that button.
 
@Mr B.

:cool:I'd completely forgotten about that! - thanks for reminding me
 

Users who are viewing this thread

Back
Top Bottom