ACC2000: How to Disable PAGE UP and PAGE DOWN Keys in a FormID: Q208826
|
This article describes how you can disable the PAGE UP and PAGE DOWN keys
in a form by using the KeyPreview property of forms.
To disable the PAGE UP and PAGE DOWN keys in a form, follow these steps:
KeyPreview: Yes
OnKeyDown: [Event Procedure]
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 33, 34
KeyCode = 0
End Select
End Sub
NOTE: KeyCodes 33 (&H21) and 34 (&H34) represent PAGE UP and PAGE DOWN, respectively. You can disable other keys on the form by including the appropriate KeyCode in the Case statement. For example, if you also want to disable the ESC key on the form, add KeyCode 27 to the Case statement as follows:
Case 27, 33, 34
For more information about the KeyPreview property, click Microsoft Access Help on the
Help menu, type keypreview property in the Office Assistant or
the Answer Wizard, and then click Search to view the topic.
Additional query words: inf
Keywords : kbdta FmsHowto
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: August 8, 1999