Good morning all,
I have a label for which the name field is programmed. Depending on the last name and address, I have two different type of text being printed:
Sarah and Mark Jones
OR
Sarah Smith and Mark Jones
My problem is that when the names are too long, it doesn't create the full second name on the second line. What it prints is the following:
Dr. Sarah Goodshall and Rev. Jonathan
Gordon
instead of:
Dr. Sarah Goodshall and
Rev. Jonathan Gordon
I have included the code below. The field name is txtName I really don't know programatically how to create the new line after the and. Thanks all for your help.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)[/color green]
If Me.LastName2 = Me.LastName1 Then
Me.txtName = Trim([Title1] & " " & [Name1] & " and " & [Title2] & " " & [Name2] & " " & [LastName1])
ElseIf Me.LastName2 <> Me.LastName1 Then
Me.txtName = Trim([Title1] & " " & [Name1] & " " & [LastName1] & " and " & [Title2] & " " & [Name2] & " " & [LastName2])
ElseIf IsNull([LastName2]) Then
Me.txtName = Trim([Title1] & " " & [Name1] & " " & [LastName1])
End If
End Sub
I have a label for which the name field is programmed. Depending on the last name and address, I have two different type of text being printed:
Sarah and Mark Jones
OR
Sarah Smith and Mark Jones
My problem is that when the names are too long, it doesn't create the full second name on the second line. What it prints is the following:
Dr. Sarah Goodshall and Rev. Jonathan
Gordon
instead of:
Dr. Sarah Goodshall and
Rev. Jonathan Gordon
I have included the code below. The field name is txtName I really don't know programatically how to create the new line after the and. Thanks all for your help.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)[/color green]
If Me.LastName2 = Me.LastName1 Then
Me.txtName = Trim([Title1] & " " & [Name1] & " and " & [Title2] & " " & [Name2] & " " & [LastName1])
ElseIf Me.LastName2 <> Me.LastName1 Then
Me.txtName = Trim([Title1] & " " & [Name1] & " " & [LastName1] & " and " & [Title2] & " " & [Name2] & " " & [LastName2])
ElseIf IsNull([LastName2]) Then
Me.txtName = Trim([Title1] & " " & [Name1] & " " & [LastName1])
End If
End Sub