The data for the report is taken from a query. The record source for the
report is the query. In the report there are hidden text boxes, one for each
item in the query. I have 5 unbound text boxes (txtLine1, txtLine2, etc.)
that I wish to conditionally fill depending on what data exists for each
records. (I think this is where I got you confused, sorry about that.) Here
is the coding behind the scenes:
If IsNull(Me.Children & Me.ExtraAddressInformation) Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname
Me.txtLine2 = Me.FullAddress1
Me.txtLine3 = Me.FullAddress2
ElseIf IsNull(Me.Children) And Len(Me.ExtraAddressInformation) > 1 Then
If Len(Me.Lastname & Me.Firstname & Me.ExtraAddressInformation) > Me.
NameLineLength Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname
Me.txtLine2 = Me.ExtraAddressInformation
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & " " & Me.
ExtraAddressInformation
Me.txtLine2 = Me.FullAddress1
Me.txtLine3 = Me.FullAddress2
End If
ElseIf Len(Me.Children) > 1 And IsNull(Me.ExtraAddressInformation) Then
If Len(Me.Lastname & Me.Firstname & Me.Children) > Me.NameLineLength Then
If Len(Me.Children) > Me.NameLineLength Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.
SplitChildrenLeft
Me.txtLine2 = Me.SplitChildrenRight
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname
Me.txtLine2 = Me.Children
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
End If
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.Children
Me.txtLine2 = Me.FullAddress1
Me.txtLine3 = Me.FullAddress2
End If
ElseIf Len(Me.Children) > 1 And Len(Me.ExtraAddressInformation) > 1 Then
If Len(Me.Lastname & Me.Firstname & Me.Children) > Me.NameLineLength Then
If Len(Me.Children) > Me.NameLineLength Then
If Len(Me.Lastname & Me.Firstname & Me.ExtraAddressInformation) >
Me.NameLineLength Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.
SplitChildrenLeft
Me.txtLine2 = Me.SplitChildrenRight
Me.txtLine3 = Me.ExtraAddressInformation
Me.txtLine4 = Me.FullAddress1
Me.txtLine5 = Me.FullAddress2
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.
SplitChildrenLeft
Me.txtLine2 = Me.SplitChildrenRight
Me.txtLine3 = Me.ExtraAddressInformation
Me.txtLine4 = Me.FullAddress1
Me.txtLine5 = Me.FullAddress2
End If
Else
If Len(Me.Lastname & Me.Firstname & Me.ExtraAddressInformation) >
Me.NameLineLength Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname
Me.txtLine2 = Me.Children
Me.txtLine3 = Me.ExtraAddressInformation
Me.txtLine4 = Me.FullAddress1
Me.txtLine5 = Me.FullAddress2
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & " " & Me.
ExtraAddressInformation
Me.txtLine2 = Me.Children
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
End If
End If
Else
If Len(Me.Lastname & Me.Firstname & Me.ExtraAddressInformation) > Me.
NameLineLength Then
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.
Children
Me.txtLine2 = Me.ExtraAddressInformation
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
Else
Me.txtLine1 = Me.Lastname & ", " & Me.Firstname & "; " & Me.
Children
Me.txtLine2 = Me.ExtraAddressInformation
Me.txtLine3 = Me.FullAddress1
Me.txtLine4 = Me.FullAddress2
End If
End If
End If
Thanks for your patience and help in all of this. This may be a VBA issue
now more than a report issue
Jeffrey
KARL said:
Whoa!! How are you doing that?
You should have a query pulling records from your table.
The record source for the report should be the query.
The control source for the text box should a field from the query.
How are you getting data from the table to the text boxes?
I mistyped. In Record C, the blank line should read:
This is a blank line that should NOT be there.
[quoted text clipped - 35 lines]