Hello Everybody,
Ok, here's my problem! I have a form (frm_Customer) that I am using to display and update customer information. I have two types of customer, personal (P) and business (B). The field Type holds either a P or B to identify customer type. I want the code in the before update event on the form to stop the update if the DisplayName (aka customer name) is null only for Type = B.
Here's my code:
Private Sub Form_BeforeUpdate (Cancel As Integer)
If Me.Type.Value = "B" And IsNull (DisplayName) = False Then
Else
MsgBox "The customer name is a required field for business customers, to continue please complete entry!", vbOKOnly
Me.DisplayName.SetFocus
Cancel = True
Exit Sub
End If
End Sub
What am I doing wrong?
Thank you in advance.
Ok, here's my problem! I have a form (frm_Customer) that I am using to display and update customer information. I have two types of customer, personal (P) and business (B). The field Type holds either a P or B to identify customer type. I want the code in the before update event on the form to stop the update if the DisplayName (aka customer name) is null only for Type = B.
Here's my code:
Private Sub Form_BeforeUpdate (Cancel As Integer)
If Me.Type.Value = "B" And IsNull (DisplayName) = False Then
Else
MsgBox "The customer name is a required field for business customers, to continue please complete entry!", vbOKOnly
Me.DisplayName.SetFocus
Cancel = True
Exit Sub
End If
End Sub
What am I doing wrong?
Thank you in advance.