I have form which is based on table (I know I know!!!)
However, I have created several buttons to do the work manually. I have a save button of which this code is part of
If Me.Dirty = True Then
If IsNull(ContactName) Or ContactName = "" And IsNull(CompanyName) Or CompanyName = "" Then
MsgBox "You must have a Contact Name or Company Name for this record!", vbOKOnly, "Missing Data"
Basically, a User must enter EITHER a Contact Name OR a Company Name OR both. At least one of the fields needs to be populated.
The code currently produces the message if none of the fields are populated. It also produces the message if CompanyName is populated. It doesn't produce the message the when the ContactName is populated.
What am I doing wrong?
However, I have created several buttons to do the work manually. I have a save button of which this code is part of
If Me.Dirty = True Then
If IsNull(ContactName) Or ContactName = "" And IsNull(CompanyName) Or CompanyName = "" Then
MsgBox "You must have a Contact Name or Company Name for this record!", vbOKOnly, "Missing Data"
Basically, a User must enter EITHER a Contact Name OR a Company Name OR both. At least one of the fields needs to be populated.
The code currently produces the message if none of the fields are populated. It also produces the message if CompanyName is populated. It doesn't produce the message the when the ContactName is populated.
What am I doing wrong?