J
JamesJ
I'm using the following code to confirm data changes.
Public Function ConfirmDataChange()
Dim frm As Form
Dim Msg, Style, Title, Response
Set frm = Screen.ActiveForm
Msg = "Data has been added or changed," & vbCrLf & "do you want to
save the changes?"
Style = vbYesNo + vbExclamation + vbDefaultButton2
Title = "Data Change Confirmation"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Else
frm.Undo
End If
End Function
This is called form the Before_Update of the form. The code
works fine. But, I want to add a Cancel button to the code that will cancel
the move to another record or closing of the form.
Any help will be appreciated.
James
Public Function ConfirmDataChange()
Dim frm As Form
Dim Msg, Style, Title, Response
Set frm = Screen.ActiveForm
Msg = "Data has been added or changed," & vbCrLf & "do you want to
save the changes?"
Style = vbYesNo + vbExclamation + vbDefaultButton2
Title = "Data Change Confirmation"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Else
frm.Undo
End If
End Function
This is called form the Before_Update of the form. The code
works fine. But, I want to add a Cancel button to the code that will cancel
the move to another record or closing of the form.
Any help will be appreciated.
James