View Full Version : Determine Escape key usage


bayman
02-11-2002, 05:17 PM
How can I determine if the Escape key has been pressed? I've tried the Form KeyPress event, but that doesn't seem to work.

In this particular form, I enable some command buttons when data changes, but pressing the Escape key cancels the data changes without disabling the buttons.

Help!

naygl
02-11-2002, 06:11 PM
I use
If (KeyAscii = vbKeyEscape) Then
MsgBox "ESC pressed"
End If

in On KeyPress. Key Preview is set to yes as well.

[This message has been edited by naygl (edited 02-11-2002).]

bayman
02-11-2002, 06:33 PM
Thanks much. It worked.