Programming Keyboard keys

S

Shree

Hi!
Is there a way to program the Esc key on the keyboard to
close a window other than creating a "Close" button to
close down the screen?
Thanks
Shree
 
S

ScottE

Private Sub Form_KeyDown(KeyCode As Integer, Shift As
Integer)
If KeyCode = vbKeyEscape Then DoCmd.Close
End Sub
 
D

Dave

I already posted this to your last post But here it is again...


I use this

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeyEscape Then DoCmd.Close 'close the form if the
user presses the ESCAPE key

End Sub
 
T

TC

That's really not a good key to use. Esc is used to discard a pending
(unsaved) change to a field or record. If you take over the escape key for
some other purpose, how are your users going to be able to perform those
other two (important) funtcions?

HTH,
TC
 

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