Pretty much a novice here but been in software development for over 30 years. Did some minor Access work about 15 years ago and been away from it since. Just gotten the go ahead to get back up to speed. A quick issue that I hope someone can help me with.
I have a form that has a "Save Changes" button on it. It will run the SaveRecord macro. That works fine. I also have this VBA code if changes have been made to the form and the user tries to exit, go to next record, etc.:
===================================
Private Sub Form_BeforeUpdate(Cancel As Integer)
' This procedure checks to see if the data on the form has
' changed. If the data has changed, the procedure prompts the
' user to continue with the save operation or to cancel it. Then
' the action that triggered the BeforeUpdate event is completed.
Dim ctl As Control
On Error GoTo Err_BeforeUpdate
' The Dirty property is True if the record has been changed.
If Me.Dirty Then
' Prompt to confirm the save operation.
If MsgBox("Do you want to save your changes?", vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
e.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
MsgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub
================================================== =
This works fine as well. But... if the user clicks the "Save Changes" button the dialog comes up as well. I'm thinking that might be a little overkill since the user is explicitly clicking on the "Save Changes" button. What needs to be added to the above VBA to only show that message if the "Save Changes" button has NOT been clicked. The name of the save button is SaveRecord.
Thanks in advance for any help!!!!!