Try to disable the escape key in an access app. If this can't be done how do i go about handling the event so that it do something other than clearing data just entered???
Have you tryed to change the action of the key in the preferences menu? Also, use the [tt]KeyPressed[/tt] event to detect the [tt]KeyCode[/tt] property of the key. Then take action. The code of Esc is $27 or use the constant vbKeyEsc.
JohnneyRingo:
I think this is because your Form doesn't have the Focus, one of your controls ON the form does. How to avoid this? I'm not certain, other than (yikes) creating a function, and setting a call to that function for EACH control's KeyDown (or KeyPress, whatevah) event.
Other than this, I believe there is a Windows API call that you can make to disable, or catch the Esc press. I'm not certain, I haven't tried that before.
I'm not sure anyone is still following this, but the solution from JohnnyRingo is a good one--thanks for the idea. To have a form with enable controls react to key press events requires using the KeyPreview property (following copied form Access help):
[tt]
A form will also receive all keyboard events, even those that occur for controls, if you set the KeyPreview property of the form to Yes. With this property setting, all keyboard events occur first for the form, and then for the control that has the focus. You can respond to specific keys pressed in the form, regardless of which control has the focus. For example, you may want the key combination CTRL+X to always perform the same action on a form.[/tt]
I hadn't seen that blurb in Access Help (not that Access help is that user friendly!) JohnnyRingo- in that case THANK YOU! You saved me much time in my CTRL-C/CTRL-V exercises. 8O) *'s for you.
Quehay- Thank you for your ammendum to Johnny's post, pointing out the beauty of his idea. *'s for you as well, especially for your ability to scour Access Help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.