Hi,
I've the following code but the cancel doesn't seem to be working, when upon click cancel, it should still remain on the form but it closed the form. Can someone please advise.
Dim strMsg As String
Dim strMsg2 As String
Dim strTitle As String
Dim strTitle2 As String
Dim intResponse As Integer
strMsg = "Do you wish to save changes?"
strMsg2 = "The changes you made were not saved."
strTitle = "Save Entry"
strTitle2 = "Entry Canceled"
If Me.Dirty Then
intResponse = MsgBox(strMsg, vbYesNoCancel, strTitle)
If intResponse = vbNo Then
Me.Undo
MsgBox strMsg2, vbOKOnly, strTitle2
ElseIf intResponse = vbCancel Then
DoCmd.CancelEvent
Me.SetFocus
End If
End If
I've the following code but the cancel doesn't seem to be working, when upon click cancel, it should still remain on the form but it closed the form. Can someone please advise.
Dim strMsg As String
Dim strMsg2 As String
Dim strTitle As String
Dim strTitle2 As String
Dim intResponse As Integer
strMsg = "Do you wish to save changes?"
strMsg2 = "The changes you made were not saved."
strTitle = "Save Entry"
strTitle2 = "Entry Canceled"
If Me.Dirty Then
intResponse = MsgBox(strMsg, vbYesNoCancel, strTitle)
If intResponse = vbNo Then
Me.Undo
MsgBox strMsg2, vbOKOnly, strTitle2
ElseIf intResponse = vbCancel Then
DoCmd.CancelEvent
Me.SetFocus
End If
End If