Esc key press

J

jon

Hi

How do I get access to press the ESC button when someone presses a button on
a form?

Thanks

Jon
 
J

jon

Hi Tom

When I load a form I automatically fill in some field but if the user close
the form but does not want the values saved, unless he removes the values
they are saved to the record, but if you press the esc key these values are
removed so the form can be closed with out the changes. So if I can simulate
pressing the ESC key before closing the form it would be handy.
I know it is not fool proof by any means but it is ok for what I need.

Jon
 
T

Tom van Stiphout

Thanks. Actually, you would have to press ESC twice: once to clear
the current field, again to clear the current record.

A great alternative is RunCommand acCmdUndo. The button wizard can
write the code for you.

-Tom.
 
J

jon

tried that in the past and it did not work.
Using access 97 so that is part of the problem.
Jon
 
J

jon

Hi Tom

No it not quite right I think being able do simulate a press of the Esc key
would be better.

Jon
 
T

Tom van Stiphout

If you REALLY must, check out the SendKeys function. Note: this is a
last resort, not a first.

-Tom.
 
J

John W. Vinson

Hi Tom

No it not quite right I think being able do simulate a press of the Esc key
would be better.

Me.Undo will erase all the user's changes to the form, restoring it to the
state where the user first touched the form.

Me.Controlname.Undo will undo changes to an individual control (equivalent to
the user pressing the Esc key once).

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top