I am trying to format 2 fields on a labels report and can't quite get it...
The 2 fields are ContactName and Title.
If the ContactName is blank, I just want the title and vice versa. But if both fields have data, I want to put comma space between them. This is what I have currently as code, which works only if there isn't a title. I have tried a myriad of other code like this, but can't get it to work.
Function AddComma()
If (Me.ContactName = "") & (Me.Title <> "") Then AddComma = Me.Title
ElseIf (Me.ContactName <> "") & (Me.Title = "") Then AddComma = Me.ContactName
Else: AddComma = Me.ContactName & ", " & Me.Title
End If
End Function
The 2 fields are ContactName and Title.
If the ContactName is blank, I just want the title and vice versa. But if both fields have data, I want to put comma space between them. This is what I have currently as code, which works only if there isn't a title. I have tried a myriad of other code like this, but can't get it to work.
Function AddComma()
If (Me.ContactName = "") & (Me.Title <> "") Then AddComma = Me.Title
ElseIf (Me.ContactName <> "") & (Me.Title = "") Then AddComma = Me.ContactName
Else: AddComma = Me.ContactName & ", " & Me.Title
End If
End Function