A
Alex
The following code works fine except that if one or more of the fields
mentioned are null, the form still closes when the user clicks the OK button
in the message. Any idea why? Thanks.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Do you want to save this log?", vbYesNo) = vbNo Then
Me.Undo
Cancel = False
Else
If IsNull(Me.Part__) Or IsNull(Me.FoundAreaCmb) Or
IsNull(Me.Defect_Quantity) Or IsNull(Me.Operator_ID) Or IsNull(Me.Sect) Or
IsNull(Me.Operation) Or IsNull(Me.Customer) Or IsNull(Me.Cause) Or
IsNull(Me.Inspector) Or IsNull(Me.Action) Then
MsgBox "There is information missing in one or more of the required
fields.", vbOKOnly
Cancel = True
End If
End If
End Sub
mentioned are null, the form still closes when the user clicks the OK button
in the message. Any idea why? Thanks.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Do you want to save this log?", vbYesNo) = vbNo Then
Me.Undo
Cancel = False
Else
If IsNull(Me.Part__) Or IsNull(Me.FoundAreaCmb) Or
IsNull(Me.Defect_Quantity) Or IsNull(Me.Operator_ID) Or IsNull(Me.Sect) Or
IsNull(Me.Operation) Or IsNull(Me.Customer) Or IsNull(Me.Cause) Or
IsNull(Me.Inspector) Or IsNull(Me.Action) Then
MsgBox "There is information missing in one or more of the required
fields.", vbOKOnly
Cancel = True
End If
End If
End Sub