Writing the Form_KeyPress Event Procedure
Private Sub Form_KeyPress(KeyAscii As Integer) Debug.Print "KeyAscii = " & KeyAscii & Space(1) & "= " & Chr(KeyAscii) If KeyAscii = 27 Then DoCmd.Close Else KeyAscii = 0 End If End Sub