J
Jani
I have a form to edit a record and my code is causing problems when there are
no changes made to the form. If I select No when there are no changes, it
gives a run-time error 2046; saving with no changes works. If there are
changes to the data it works fine either saving or not saving. Below is my
code. Any help would be very much appreciated. Thank you! Jani
Private Sub Command129_Click()
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & " Do you wish to save the changes?"
strMsg = strMsg & " Click Yes to Save or No to Discard changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
DoCmd.Close
DoCmd.OpenForm "frm_MainMenu"
Else
DoCmd.RunCommand acCmdUndo
DoCmd.Close
DoCmd.OpenForm "frm_MainMenu"
End If
End Sub
no changes made to the form. If I select No when there are no changes, it
gives a run-time error 2046; saving with no changes works. If there are
changes to the data it works fine either saving or not saving. Below is my
code. Any help would be very much appreciated. Thank you! Jani
Private Sub Command129_Click()
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & " Do you wish to save the changes?"
strMsg = strMsg & " Click Yes to Save or No to Discard changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
DoCmd.Close
DoCmd.OpenForm "frm_MainMenu"
Else
DoCmd.RunCommand acCmdUndo
DoCmd.Close
DoCmd.OpenForm "frm_MainMenu"
End If
End Sub