The information in this article applies to:
SUMMARY
This 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 INFORMATIONMethod 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:
The 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.
REFERENCES
For more information about the OnKeyPress function in version 2.0,
please see the following article in the Microsoft Knowledge Base:
Additional query words: pgup pgdn
Keywords : kbusage FmsOthr |
Last Reviewed: April 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |