Solved

Simulating the ESC Key.

Posted on 1999-01-11
2
377 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
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 40 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

772 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