Undo for current field (1 Viewer)

gg

Registered User.
Local time
Today, 08:30
Joined
Aug 1, 2000
Messages
23
How do I create an Undo button that will do the same thing that the forms tool bar Undo does? i.e., I want to undo only the last changed field in a record when the button is clicked-NOT changes in other fields. The keyboard Escape key will do this from the keyboard, but when a button sends {Esc} via sendKeys, it wipes out all changes. Undo via macro or code does same. I don't give users access to the toolbar, so can't use that.
 

Schof

Registered User.
Local time
Today, 08:30
Joined
Nov 15, 2002
Messages
44
If you say that the Undo button works from the toolbar then you can call the toolbar using the DoMenuItem method.

For Example:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acUndo, , acMenuVer70

or you can try...

DoCmd.RunCommand acCmdUndo
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:30
Joined
Feb 19, 2002
Messages
43,478
Me.Undo - removes all changes to the current record
Me.SomeField.Undo - removes all changes to SomeField

If you add your own button, the button will be the current field so you would need to use the Screen.PreviousControl to obtain a reference to the previous control before you can undo changes to it.
 

Users who are viewing this thread

Top Bottom