I'm using the following code to ask whether to save changes to a record or not:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Dim msg, style, TITLE, Response
msg = "Record(s) have been added or changed." & vbCrLf & "Save the Changes?"
style = vbYesNo + vbQuestion
TITLE = "Data Change Confirmation"
Response = MsgBox(msg, style, TITLE)
If Response = vbYes Then
Else
Me.Undo
End If
End If
End Sub
I want to add a 3rd option to cancel the close and return to make more changes to the form data.
Currently I don't call this form a command button. The code triggers after I click the forms close (x) button. But I thing I'll need to call this from a command button.
I've found several example on the internet but not haven't tried any of them because they seem to be very different.
Any help will be appreciated,
James
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Dim msg, style, TITLE, Response
msg = "Record(s) have been added or changed." & vbCrLf & "Save the Changes?"
style = vbYesNo + vbQuestion
TITLE = "Data Change Confirmation"
Response = MsgBox(msg, style, TITLE)
If Response = vbYes Then
Else
Me.Undo
End If
End If
End Sub
I want to add a 3rd option to cancel the close and return to make more changes to the form data.
Currently I don't call this form a command button. The code triggers after I click the forms close (x) button. But I thing I'll need to call this from a command button.
I've found several example on the internet but not haven't tried any of them because they seem to be very different.
Any help will be appreciated,
James