Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

Simulating the ESC Key.

Hi.  I'm using some Visual Basic code in Access, and I want to use code to simulate the same effect as the user pressing the Esc key.  Maybe I should post this in the access section, but as I say, it's VB code.

When I start to edit a record on a form, and then change my mind, I have to hit ESC to cancel the half entered record.  I simply want to be able to have the code execute this without the user pressing the key.  

I know the KeyAscii for ESC is 27.  Can I somehow use this to tell the computer to "Press Key 27?"

Thanks for any help.

TISS
0
TISS
Asked:
TISS
1 Solution
 
watyCommented:
use the sendkeys function :

sendkeys "{esc}"

0
 
TISSAuthor Commented:
Just what I'm looking for.  Thanks.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now