I have a Form were I converted a a field to a combo box and added the selectable values I want to be available. I also wanted to add a user confirmation to any edits for this field. My VBA is very basic, but I found some code online, I am running a BeforeUpdate macro with the following code,
Private Sub ACTIVE_FLAG_BeforeUpdate(Cancel As Integer)
If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub
The prompt and yes no confirmation are working fine when the data is changed, the save cmd is working fine when "yes" is selected, but when "No" is selected I receive
Run-Time error '20146'
The command or action 'Undo' isnt available now?
Any thoughts on what I might have wrong and how it can be fixed?
Private Sub ACTIVE_FLAG_BeforeUpdate(Cancel As Integer)
If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub
The prompt and yes no confirmation are working fine when the data is changed, the save cmd is working fine when "yes" is selected, but when "No" is selected I receive
Run-Time error '20146'
The command or action 'Undo' isnt available now?
Any thoughts on what I might have wrong and how it can be fixed?