Disable Esc Key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to disbale the ESC key so that it won't erase the current
unentered data? If a kiddo pushes in their keyboard, sometimes a fault in
the design of the keyboard tray will hit their ESC key and erase their work.
The easiest way is to disable the ESC key. How?
 
Make sure you have KeyPreview set to yes for the form and paste the
following behind it:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
'Comment out the next line, it's just for demo purposes
MsgBox "Esc key disabled."
KeyCode = 0
End If
End Sub

HTH

Jamie
 

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