Writing the Form_KeyPress Event Procedure : Key « Access « VBA / Excel / Access / Word






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 

 








Related examples in the same category

1.Writing the Form_KeyDown Event Procedure
2.Shift key, alt key and control key mask
3.Writing the Form_KeyUp Event Procedure
4.Arrow key, page up, page down key
5.Check the keycode