Article ID: 210401 - View products that this article applies to.
This article was previously published under Q210401
This article has been archived. It is offered "as is" and will no longer be updated.
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
This article shows you how to trap the ENTER, TAB, SHIFT+TAB, PAGE UP, and PAGE DOWN keys when they are pressed in a form, and how to either replace a given key's action with another action or disable the action.
In Microsoft Access 2000, you can use the KeyDown event to trap keystrokes. You can then assign a value of 0 (zero) to the keystrokes that cause the text box or other data object to lose focus. Doing this prevents these keys from being used to move the focus to a different data object.
To disable the TAB, ENTER, PAGE UP, and PAGE DOWN keys, follow these steps:
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.