Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undo Previous Action

Status
Not open for further replies.
Nov 24, 2003
57
US
Does anyone know how to only undo the previous action? The undo event in VBA undos all the changes that you've made during the current session but I just want to undo the most recent change on a single field. Is there a way I can do this? Thanks.
 
If the field is on a form, you can use the undo method, like the following:

Forms!form1.salesordernumber.undo

That will just undo the change on the field Salesordernumber on form 1.

Hope thats what you needed.

ChaZ
 
Provided the form/control is bound to a Table/Query, you can use the Undo Method on a control and it will reset the control. However, this will not work for those controls/forms that are not bound.

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
When the going gets tough, the tough gets going.
 
You should look at the Before Update Event for the control on the Form. You can run a Cancel command from it and an Undo for the Control only.

Private Sub ControlName_BeforeUpdate(Cancel as Integer)
If SomeValue = aValue Then
Cancel = True
ControlName.Undo
Else
Do something here
End If
End Sub

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top