Solved

Simulating the ESC Key.

Posted on 1999-01-11
2
374 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
Comment Utility
use the sendkeys function :

sendkeys "{esc}"

0
 

Author Comment

by:TISS
Comment Utility
Just what I'm looking for.  Thanks.

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now