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?
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?