By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,903 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,903 IT Pros & Developers. It's quick & easy.

acCmdUndo 3 different behaviors!!

P: 47
The application I'm developing allows the user to edit fields. If a field has changed when the user clicks on a different control (or another record in the multi-record subform), a messagebox gives the user the option to save, undo or cancel. The problem is with the undo:

I'm testing it with repeated edits in a single field; I edit the field, click on another control or record and select undo ("no"). The first time, the undo works fine.

I edit the field again and click elsewhere, select undo from the message box and I get an error that "the command or action undo isn't available".

I cancel the error message dialog box and edit the field again, click elsewhere. This time the undo deletes the entire edited field.

Please help.

All of the data and the code are in a subform:

Private Sub Form_AfterUpdate()
Dim intYesNo As Integer
intYesNo = MsgBox("Yes to Save, No to Delete Record", vbQuestion + vbYesNoCancel, "Enter")
If intYesNo = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
ElseIf intYesNo = vbNo Then

'the debugger brings me to this line when I get the error message
DoCmd.RunCommand acCmdUndo
End If
End Sub
Nov 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: 47
More question related to the last question.

I have also tried to use Me.undo in the subform, instead of acCmdUndo. When I test it in the subform as a free-standing form it works fine. But when I test it in the subform as part of the "master form" it does NOTHING.

Ideas?

Thanks
Nov 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.