ramhanuman
Registered User.
- Local time
- Today, 13:54
- Joined
- May 1, 2012
- Messages
- 13
I'm trying to work with the form unload event but even when the user wants to exit the form without saving the information, the info still gets saved into the database.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull([First Name]) Then
Cancel = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("The current information will not save, do you still want to exit?", vbYesNo, "CLOSE") = vbNo Then
Cancel = True
Else
Me.Dirty = False
Me.Undo
End If
End Sub
Why is the form saving the info into the database even though the user wants to exit without saving?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull([First Name]) Then
Cancel = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("The current information will not save, do you still want to exit?", vbYesNo, "CLOSE") = vbNo Then
Cancel = True
Else
Me.Dirty = False
Me.Undo
End If
End Sub
Why is the form saving the info into the database even though the user wants to exit without saving?