totn Access

MS Access 2003: Disable the Esc key in a form

This MSAccess tutorial explains how to disable the Esc key in a form in Access 2003 (with screenshots and step-by-step instructions).

Question: In Microsoft Access 2003/XP/2000/97, how do you disable the Esc key in an Access form?

Answer: To disable the Esc key in an Access form, open your form in design view. Set the form's property called "Key Preview" to Yes.

Microsoft Access

Then select the property called "On Key Down" and click on the button with the three dots to the right.

Microsoft Access

When the Choose Builder window appears, highlight Code Builder and click on the OK button.

Microsoft Access

Next, paste in the following code:

If KeyCode = vbKeyEscape Then
   KeyCode = 0
End If

Your code should look as follows:

Microsoft Access

Now, the Esc key should be disabled on your form.