acramer_dominium
asked on
Create a custom keyboard shortcut in VBA for Access
Experts. I have a user that is using a database (that was created before my time) that's pretty data entry intensive. It's used for tracking employee vacation days. The user that's doing the data entry would like to be able to hit a combination of ctrl + [ ] and have the focus on the screen move to a certain combo box.
So far I haven't found anything on how to accomplish this. Anyone know if this is possible? If so, suggestions?
Thank you in advance!
So far I haven't found anything on how to accomplish this. Anyone know if this is possible? If so, suggestions?
Thank you in advance!
ASKER
Is there a way to do this if the user isn't on a specific control when he wants to execute the keyboard shortcut/macro? He may enter three vacation records for one employee and then want to execute the macro so it isn't necessarily each time he enters a new record.
No matter where he is on the screen, is there a way he can hit ctrl + n to move to a specified combo box?
No matter where he is on the screen, is there a way he can hit ctrl + n to move to a specified combo box?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
AWESOME!! I looked up key codes and found that ctrl + d will work better. Never knew this was possible. THANK YOU!! I really appreciate it.
1. Macro called 'AutoKeys' - If you have this macro in your DB, access looks to this for keyboard shortcuts first, then uses defaults if not found. This is app wide.
2. At the form level setting KeyPreview to True, and using the KeyPress event. Or you can use key down/up.
3. Using the Keypress, key down, and up at control level.
Jim.