Supressing error code 2619

lution

Registered User.
Local time
Yesterday, 21:04
Joined
Mar 21, 2007
Messages
114
I have a required property and when the use exits the form, I want to give them the choice of returning to the form and adding a value or continuing to close. I also want to supress the standard dialog for warning the user about discarding their changes.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intDiscard As Integer

If IsNull(Me.Citation) Then
intDiscard = MsgBox("Discard the record because the citation number is blank?", vbYesNo)
If (intDiscard = vbYes) Then
Cancel = False
Else
Cancel = True
End If
End If

End Sub

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2169 Then Response = acDataErrContinue
End Sub

However, it always exists the form regardless of what the user selects for the "Discard" message box. Could someone help me with my logic?
 
If someone CLOSES the form, you can't cancel that close from the BeforeUpdate event. You would need to capture it in the On UNLOAD event.
 
But if the record is dirty, by the time the UNLOAD event fires, any changes the user made will be discarded because the required cell doesn't have a value so I thought I needed to ask the user about discarding in UNLOAD.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom