Programming Keyboard keys

  • Thread starter Thread starter Shree
  • Start date Start date
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
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As
Integer)
If KeyCode = vbKeyEscape Then DoCmd.Close
End Sub
 
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
 
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
 
Back
Top