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
 

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

Back
Top