Escape key when entering new record

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

Guest

When 'escape' is hit after entering data in a new record, all bound controls
get re-initialized. How can I detect this so I can re-initialize unbound
controls?
 
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
 
Back
Top