I have a small form, which comes up when I press a button in a Windows Forms application.
I want to be able to close the form by pressing the escape key. How could I do t
Paste this code into the "On Key Down" Property of your form, also make sure you set "Key Preview" Property to "Yes".
If KeyCode = vbKeyEscape Then DoCmd.Close acForm, "YOUR FORM NAME"