Table of contents
XML
TOC
Collapse the table of content
Expand the table of content

Disable PAGE UP and PAGE DOWN Keys in a Form

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

Note You must set the form's KeyPreview property to True in order for this procedure to work.

© 2018 Microsoft