What do you REALLY want to accomplish? There might be better ways.
-Tom.
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
> What do you REALLY want to accomplish? There might be better ways.
> -Tom.
[quoted text clipped - 8 lines]
>>
>>Jon
Tom van Stiphout - 15 Jan 2008 02:52 GMT
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.
>Hi Tom
>
[quoted text clipped - 19 lines]
>>>
>>>Jon
jon - 15 Jan 2008 03:14 GMT
tried that in the past and it did not work.
Using access 97 so that is part of the problem.
Jon
> Thanks. Actually, you would have to press ESC twice: once to clear
> the current field, again to clear the current record.
[quoted text clipped - 31 lines]
>>>>
>>>>Jon
jon - 15 Jan 2008 03:18 GMT
Thanks Tom I shall now eat my words
sorted
Thanks
Jon
> tried that in the past and it did not work.
> Using access 97 so that is part of the problem.
[quoted text clipped - 35 lines]
>>>>>
>>>>>Jon
jon - 15 Jan 2008 06:11 GMT
Hi Tom
No it not quite right I think being able do simulate a press of the Esc key
would be better.
Jon
> Thanks Tom I shall now eat my words
> sorted
[quoted text clipped - 42 lines]
>>>>>>
>>>>>>Jon
Tom van Stiphout - 15 Jan 2008 13:41 GMT
If you REALLY must, check out the SendKeys function. Note: this is a
last resort, not a first.
-Tom.
>Hi Tom
>
[quoted text clipped - 49 lines]
>>>>>>>
>>>>>>>Jon
John W. Vinson - 15 Jan 2008 17:30 GMT
>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]