How to: Disable PAGE UP and PAGE DOWN Keys in a Form

Access Developer Reference

By default, the PAGE UP and PAGE DOWN keys can be used to navigate between records in a form. The followng example illustrates how to use a form's KeyDown event to disable the use of the PAGE UP and PAGE DOWN keys in the form.

  Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
' The Keycode value represents the key that
' triggered the event.
Select Case KeyCode

    ' Check for the PAGE UP and PAGE DOWN keys.
    Case 33, 34

    ' Cancel the keystroke.
    KeyCode = 0
End Select

End Sub

Bb243782.vs_note(en-us,office.12).gif  Note
You must set the form's KeyPreview property to True in order for this procedure to work.