Undo Button

H

Heather

Hello,

I have created an Undo button for my form withe th following code.

Private Sub cmdUndo_Click()
if Me.Dirty Then Me.Undo
End Sub

The problem is that it un-does everything that I changed and I do not want
it to do that- How can I undo one field at a time. Also I do not want the
undo button to become active unless I update something on the form and when I
leave to another record - I want the button to turn off untill again untill
updates are made.

Thanks!
 
J

Jeanette Cunningham

Hi Heather,
one easy way is to forget about undo buttons.
Pressing the Esc key once will undo any edit to the current control.
Pressing it again will undo any edit to the current record.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
T

tina

as an additional note: if the control you're in has *not* been edited, the
first Esc will undo all edits in the current record. also, you can't Undo
edits once the focus has moved off the current record - to another record,
into or out of a subform, or if the form is closed of course.

hth
 
A

AccessVandal via AccessMonster.com

Heather,

The questions would be, how do you want to design your form like…
How can I undo one field at a time.

Do you mean you want to create a button to undo for each and every control
(textboxes)? If there are 100 textboxes, you need 100 buttons? It’s possible
to undo edited controls by using code to loop thru each control to check new
values and old values.

How do you prevent the users after editing the record, when they can just
click on the Record Selector that will save this record without warning? Do
you have any code yet?
Also I do not want the undo button to become active unless I update something on the form >and when I leave to another record.

It can be done but… most of us use the form’s BeforeUpdate events to enable
the button. Then again we might use the current event in your case.
I want the button to turn off until again until updates are made.

It can be done but…. most likely candidate would be the form’s current event.
 

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