Under the form's Property Box set Key Preview to Yes, then:
Private Sub form_keydown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyEscape
MsgBox ("Escape Key Pressed")
Case Else
End Select
End Sub
Replace the messagebox with the your code to re-initialize your controls.
IF you wanted to kill the escape key, i.e. make it non-functional, you could
do this:
Private Sub form_keydown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyEscape
KeyCode = 0
Case Else
End Select
End Sub
--
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
Message posted via AccessMonster.com