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_AfterUpdat e()
Dim intYesNo As Integer
intYesNo = MsgBox("Yes to Save, No to Delete Record", vbQuestion + vbYesNoCancel, "Enter")
If intYesNo = vbYes Then
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
ElseIf intYesNo = vbNo Then
'the debugger brings me to this line when I get the error message
DoCmd.RunComman d acCmdUndo
End If
End Sub
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_AfterUpdat e()
Dim intYesNo As Integer
intYesNo = MsgBox("Yes to Save, No to Delete Record", vbQuestion + vbYesNoCancel, "Enter")
If intYesNo = vbYes Then
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
ElseIf intYesNo = vbNo Then
'the debugger brings me to this line when I get the error message
DoCmd.RunComman d acCmdUndo
End If
End Sub
Comment