C
Carolyn
I have a macro that prompts a user regarding saving changes prior to
exiting the database. It is in the beforeupdate section of the form.
How would I modify the code to only prompt save if data has changed?
The way it is now, you are prompted if you only view the form.
Thank you in advance for any help.
Private Sub Form_BeforeUpdate(Cancel As Integer)
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
'do nothing
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub
exiting the database. It is in the beforeupdate section of the form.
How would I modify the code to only prompt save if data has changed?
The way it is now, you are prompted if you only view the form.
Thank you in advance for any help.
Private Sub Form_BeforeUpdate(Cancel As Integer)
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
'do nothing
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub