I have a subform(wihtin a main form) that opens in read only. There is a EDIT button that opens separate formr to edit the subform records. On this second form there is a Cancel button that will undo any changes and closes the form. This is the basic code for the Cancel button.
The problem is that if a person clicks the Cancel button before any changes are made then they get an error(2046, Undo isn't available now), probably because there is nothing to undo. I would like to undo and close if changes were made, or close if no changes made.Code:Private Sub Command46_Click() ' Undo the changes DoCmd.RunCommand acCmdUndo ' Close the form DoCmd.Close acForm, Me.Name End Sub
I know I need some type of error trapping, but would appreciate any help.