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





Writing the Form_KeyDown Event Procedure

 
Private Sub Form_KeyDown (KeyCode As Integer, Shift As Integer) 
    Select Case KeyCode 
        Case vbKeyF1 
            MsgBox "You pressed the F1 key." 
        Case vbKeyHome 
            MsgBox "You pressed the Home key." 
        Case vbKeyTab 
            MsgBox "You pressed the Tab key." 
    End Select 
End Sub 

 










Related examples in the same category

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