I have a form that requires some mandatory information. The following code checks the form before updating.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Surname) Or IsNull(Me.Address) Or IsNull(Me.Suburb) Then
MsgBox ("Surname, Address and Suburb are mandatory"), vbInformation
Me.Surname.SetFocus
Cancel = True
End If
End Sub
This works correctly but after the msgbox is displayed, another Access message is displayed:
"The setting you entered isn't valid for this property"
This message is caused by the "Cancel = True" command.
How do I stop this?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Surname) Or IsNull(Me.Address) Or IsNull(Me.Suburb) Then
MsgBox ("Surname, Address and Suburb are mandatory"), vbInformation
Me.Surname.SetFocus
Cancel = True
End If
End Sub
This works correctly but after the msgbox is displayed, another Access message is displayed:
"The setting you entered isn't valid for this property"
This message is caused by the "Cancel = True" command.
How do I stop this?