Avatar of Sonny G
Sonny G

asked on 

Can KeyDown be coded for Access application-wide or just on each form?

On each form I have the following sub:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
 '***********************
 '* Ignore function keys *
 '***********************
    Select Case KeyCode
        Case vbKeyPageUp
            KeyCode = 0
        Case vbKeyPageDown
            KeyCode = 0
        Case vbKeyPageDown
            KeyCode = 0
        Case vbKeyF1
            KeyCode = 0
        Case vbKeyF2
            KeyCode = 0
        Case vbKeyF3
            KeyCode = 0
        Case vbKeyF4
            KeyCode = 0
        Case vbKeyF5
            KeyCode = 0
        Case vbKeyF6
            KeyCode = 0
        Case vbKeyF7
            KeyCode = 0
        Case vbKeyF8
            KeyCode = 0
        Case vbKeyF9
            KeyCode = 0
        Case vbKeyF10
            KeyCode = 0
        Case vbKeyF11
            KeyCode = 0
        Case vbKeyF12
            KeyCode = 0
        Case vbKeyPageUp
            KeyCode = 0
        Case vbKeyPageDown
            KeyCode = 0
    End Select
End Sub

Is it possible to place a variation of this code in a global module that would affect all forms throughout the entire application?

Thanks, in advance, for your guidance.


Microsoft AccessVBA

Avatar of undefined
Last Comment
Sonny G

8/22/2022 - Mon