views:

70

answers:

1

I have a bound form in microsoft access that allows a user to add data to a table. I want to place a "cancel" button on the form, that if clicked, will stop the record commitment.

What is the command I need to cancel the record commitment?

+3  A: 

It's been a few years since I've had to work with Access, but you should be able to undo changes to the current record using the command:

DoCmd.RunCommand acCmdUndo

or

Me.Undo

?

Gordon Bell
Controls also have an Undo method, i.e., Me!MyTextBox.Undo.
David-W-Fenton
I have exactly the same problem as the OP but in my case, there's a calculate button that sets a bunch of fields on the form. acCmdUndo will undo changes but not changes that the calculate caused. something to be aware of.
Knox
Knox, not sure if this will work, but have you tried: txtCalcField.Value = txtCalcField.OldValue
Gordon Bell
Or txtCalcField.Refresh?
David-W-Fenton
I don't think that you can set the Value property of a control that is not editable, which would be the case for a calculated control.
David-W-Fenton