ACC1x: How to Disable PAGE UP and PAGE DOWN Keys in a Form (1.x)Last reviewed: April 24, 1997Article ID: Q114504 |
The information in this article applies to:
SUMMARYThis article describes the following two techniques that you can use to disable the use of the PAGE UP and PAGE DOWN keys in a form:
CAUTION: Re-creating the examples in this article will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.
MORE INFORMATION
Method 1: Opening the Form as Dialog Using the OpenForm Macro ActionThe PAGE UP and PAGE DOWN keys will be inoperative in a form if the form is opened using an OpenForm macro action with the Window Mode argument set to Dialog. To demonstrate this technique, create a new macro in the sample database NWIND.MDB with the following action:
OpenForm Form Name: Customers Filter Name: <leave empty> Where Condition: <leave empty> View: Form Data Mode: Edit Window Mode: DialogThe drawback to this technique is that a Dialog form cannot use a custom menu, nor will you be able to switch to another form while the dialog form is open. NOTE: The Microsoft Access Wizards use this technique to limit navigation in multiple-page forms.
Method 2: Using the GetKeyState() API Call to Trap PAGE UP and PAGE DOWNThe following sample user-defined function, DisablePGUP_PGDN(), demonstrates how to use the GetKeyState() Windows API call to detect and trap the PAGE UP and PAGE DOWN keys. Attach this function to the OnExit property of all the controls on a form where the PAGE UP and PAGE DOWN keys should be disabled. NOTE: You may have some Microsoft Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive a duplicate procedure name error message, remove or comment out the declarations statement in your code.
=DisablePGUP_PGDN() REFERENCESFor more information about the OnKeyPress function in version 2.0, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q114506 TITLE : ACC2: How to Disable PAGE UP and PAGE DOWN Keys in a Form (2.0)Microsoft Access "Language Reference," versions 1.0 and 1.1, pages 348-349
|
Additional query words: pgup pgdn
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |