Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
By default, the PAGE UP and PAGE DOWN keys can be used to navigate between records in a form. The following 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
Note
You must set the form's KeyPreview property to True for this procedure to work.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.