M
Maria
I am new to Access - I have Access 2003.
I have a form that contains a Close Button with code in the OnClick Event
(see below for code). However, when a person does not make a change to the
record on the form and clicks the Close button and clicks No to not save any
changes - I get an error indicating that the Undo is not understandable at
the said time.
I think I should be checking to see if a forms data has been edited - how do
I go about doing this?
Also, I do not want to place the code in the BeforeUpdate Event on the Form.
Private Sub btn_CloseEmpresas_Click()
Dim strMsg As String
strMsg = "Data has been Changed."
strMsg = strMsg & " Would you like to save changes?"
strMsg = strMsg & " Click on Yes to Save and No to Disregard the
changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Data?") = vbYes Then
'do nothing
DoCmd.Close
Else
DoCmd.RunCommand acCmdUndo
DoCmd.Close
End If
End Sub
Thank you in advance
Maria
I have a form that contains a Close Button with code in the OnClick Event
(see below for code). However, when a person does not make a change to the
record on the form and clicks the Close button and clicks No to not save any
changes - I get an error indicating that the Undo is not understandable at
the said time.
I think I should be checking to see if a forms data has been edited - how do
I go about doing this?
Also, I do not want to place the code in the BeforeUpdate Event on the Form.
Private Sub btn_CloseEmpresas_Click()
Dim strMsg As String
strMsg = "Data has been Changed."
strMsg = strMsg & " Would you like to save changes?"
strMsg = strMsg & " Click on Yes to Save and No to Disregard the
changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Data?") = vbYes Then
'do nothing
DoCmd.Close
Else
DoCmd.RunCommand acCmdUndo
DoCmd.Close
End If
End Sub
Thank you in advance
Maria