I have the code below for the On Key Down event with the Key Preview property set to "yes". This works for pretty much everything except split forms. Does anyone know why and how to fix it? Is the keycodes for split forms different?
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'to activate statements below, set Key Preview property to "yes" for each form.
'then paste this code to each form in the "On Key Down" event.
If KeyCode = vbKeyF1 Then
KeyCode = 0
End If
If KeyCode = vbKeyF2 Then
KeyCode = 0
End If
If KeyCode = vbKeyF3 Then
KeyCode = 0
End If
If KeyCode = vbKeyF4 Then
KeyCode = 0
End If
If KeyCode = vbKeyF5 Then
KeyCode = 0
End If
If KeyCode = vbKeyF6 Then
KeyCode = 0
End If
If KeyCode = vbKeyF7 Then
KeyCode = 0
End If
If KeyCode = vbKeyF8 Then
KeyCode = 0
End If
If KeyCode = vbKeyF9 Then
KeyCode = 0
End If
If KeyCode = vbKeyF10 Then
KeyCode = 0
End If
If KeyCode = vbKeyF11 Then
KeyCode = 0
End If
If KeyCode = vbKeyF12 Then
KeyCode = 0
End If
If KeyCode = vbKeyPageUp Then
KeyCode = 0
End If
If KeyCode = vbKeyPageDown Then
KeyCode = 0
End If
If KeyCode = vbKeyMenu Then
KeyCode = 0
End If
If KeyCode = vbKeyEnd Then
KeyCode = 0
End If
If KeyCode = vbKeyHome Then
KeyCode = 0
End If
'80=P, 83=S, 109=- on NumPad, 107=+ on NumPad, 187==/+ next to backspace, 189=-/_ next to =/+ key
'65=A, 70=F, 71=G, 72=H, 74=J, 13=Enter, 90=Z, 186=;/:, 188=,/<, 190=./>
If (Shift And acCtrlMask) And (KeyCode = 80 Or KeyCode = 83 Or KeyCode = 109 _
Or KeyCode = 107 Or KeyCode = 187 Or KeyCode = 189 Or KeyCode = 65 Or KeyCode = 70 _
Or KeyCode = 71 Or KeyCode = 72 Or KeyCode = 74 Or KeyCode = 13 Or KeyCode = 90 _
Or KeyCode = 186 Or KeyCode = 188 Or KeyCode = 190) Then
KeyCode = 0
End If
If (Shift And acAltMask) > 0 Then
KeyCode = 0
Shift = 0
End If
End Sub