T
Travis (New User)
I want a data editing form to check for any changes when an exit button is
clicked. So here is the following code that I have done. (I always get Run
Time Error 13. Type Mismatch) Any help would be greatly appreciated!
Private Sub Form_Close()
If Me.DataChange Then
Dim strMsg As String
Dim Cancel As Integer
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
Me.Undo
Cancel = True
End If
Else
'do nothing
End If
End Sub
clicked. So here is the following code that I have done. (I always get Run
Time Error 13. Type Mismatch) Any help would be greatly appreciated!
Private Sub Form_Close()
If Me.DataChange Then
Dim strMsg As String
Dim Cancel As Integer
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
Me.Undo
Cancel = True
End If
Else
'do nothing
End If
End Sub