Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Esc key like close Form

Esc key like close Form

Esc key like close Form

A newbie here would like to know how I can code the Esc key to also act like a Close Form command button.    
I have the command button on my Form,  but of course the users don't want to click it, they just want to hit Esc.


RE: Esc key like close Form

You would just need to creat a macro called autokeys.  
 as per A97 follow these procedures

Assign an action or set of actions to a key

You can assign an action or set of actions to a specific key or key combination by creating an AutoKeys macro group. When you press the key or key combination, Microsoft Access carries out the action.

1    In the Database window, click the Macros tab.
2    Click New.
3    Click Macro Names    on the toolbar.
4    In the Macro Name column, type the key or key combination to which you want to assign the action or set of actions.

For information on the key combinations you can use to make key assignments, click  .

5    Add the action or set of actions you want the key or key combination to carry out. For example, you could add a RunMacro action that runs the Print Current Record macro when CTRL+P is pressed.

6    Repeat steps 4 and 5 for any other key assignments you want to make.
7    Save the macro group with the name AutoKeys.

The new key assignments are in effect as soon as you save the macro group and each time you open the database.

Note   If you assign a set of actions to a key combination that is already being used by Microsoft Access (for example, CTRL+C is the key combination for Copy), the actions you assign this key combination replace the Microsoft Access key assignment.

RE: Esc key like close Form

a much simpler way:

in the properties of the Close button,
make the 'cancel' yes

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close