Programming keyborads events

  • Thread starter Thread starter Shree
  • Start date Start date
S

Shree

Hi all,
Can someone tell me if the "Esc" Key can be programmed to
close the form? I tried onKeypress Keyasccii value but
that didnt work. Is there another way?
Please help.
TIA
Shree
 
Can someone tell me if the "Esc" Key can be programmed to
close the form? I tried onKeypress Keyasccii value but
that didnt work. Is there another way?

I usually have a Cancel or Close button on the form with its Cancel
Property set to True.

Tim F
 
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
 
Back
Top