Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simulating the ESC Key.

Posted on 1999-01-11
2
Medium Priority
?
382 Views
Last Modified: 2006-11-17
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
Comment
Question by:TISS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 160 total points
ID: 1455342
use the sendkeys function :

sendkeys "{esc}"

0
 

Author Comment

by:TISS
ID: 1455343
Just what I'm looking for.  Thanks.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question