Undo button

M

Mazza

Can anyone help please.
I have form with 2 subforms on it I have a button on the main form which is
disabled and enabled on the 'dirty' event, I have then put code behind the
button to undo the current entry, if required.
What I don't know is how do I ensure that the data entered if any in the sub
forms also undoes when the undo button is clicked.
Also what code would I use that allows you to click the undo button even if
there is nothing to undo without an error message popping up.
Thanks in advance to anyone who can help me with this.
Mazza T
 
A

Allen Browne

Two parts to your question

a) There is no simple way to make an Undo button that applies to changes
entered in multiple forms (such as a form and subform.)

Accesss uses separate transactions in each form. Additionally, in a
typically form/subform connected via LinkMasterFields/LinkChildFields, the
subform gets reloaded each time the values in the main form change (by user
entry, or by moving record.)

It gets very convoluted to handle this by copying the records out to
temporary tables and making the changes there, particularly in a multi-user
environment like Access is.

b) Just test the Dirty property of the form before undoing it:

If Me.Dirty Then
Me.Undo
End If
 
M

Mazza

Thanks Allen it's now a lot clearer to me


Allen Browne said:
Two parts to your question

a) There is no simple way to make an Undo button that applies to changes
entered in multiple forms (such as a form and subform.)

Accesss uses separate transactions in each form. Additionally, in a
typically form/subform connected via LinkMasterFields/LinkChildFields, the
subform gets reloaded each time the values in the main form change (by
user entry, or by moving record.)

It gets very convoluted to handle this by copying the records out to
temporary tables and making the changes there, particularly in a
multi-user environment like Access is.

b) Just test the Dirty property of the form before undoing it:

If Me.Dirty Then
Me.Undo
End If
 

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

Similar Threads


Top