report detail section

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Would like to resize a reports detail section if a field is null to get more
contacts per page. My code below works to show and hide the field but does
not resize. Help.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull() Then
Me.EMAIL.Visible = False
Me.Detail.Height = 2.2083
ElseIf Not IsNull([EMAIL]) Then
Me.EMAIL.Visible = True
Me.Detail.Height = 2.375
End If
If IsNull([ContactDate]) Then
Me.ContactDate.Visible = False
ElseIf Not IsNull([ContactDate]) Then
Me.ContactDate.Visible = True
End If
End Sub
 
Ray Wold said:
Would like to resize a reports detail section if a field is null to get more
contacts per page. My code below works to show and hide the field but does
not resize. Help.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull() Then
Me.EMAIL.Visible = False
Me.Detail.Height = 2.2083
ElseIf Not IsNull([EMAIL]) Then
Me.EMAIL.Visible = True
Me.Detail.Height = 2.375
End If
If IsNull([ContactDate]) Then
Me.ContactDate.Visible = False
ElseIf Not IsNull([ContactDate]) Then
Me.ContactDate.Visible = True
End If
End Sub[/QUOTE]


Changing the size of a section is only available in AXP and
later versions. Regardless of that, it is better done using
the CanGrow/CanShrink properties. In this case I think all
you need is to set each of those text boxes' and the detail
section's CanShrink property to Yes. Then when you make a
text box invisible it, and its attached lable, will shrink
up the space they're not using. This should be all the code
that's needed:

Me.EMAIL.Visible = Not IsNull(Me.EMAIL)
Me.ContactDate.Visible = Not IsNull(Me.ContactDate)

If the text boxes do not have an attached label, then you do
not need any code at all. A null text box will shrink
automatically.
 
Thank you. That did it.

Marshall Barton said:
Ray Wold said:
Would like to resize a reports detail section if a field is null to get more
contacts per page. My code below works to show and hide the field but does
not resize. Help.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull() Then
Me.EMAIL.Visible = False
Me.Detail.Height = 2.2083
ElseIf Not IsNull([EMAIL]) Then
Me.EMAIL.Visible = True
Me.Detail.Height = 2.375
End If
If IsNull([ContactDate]) Then
Me.ContactDate.Visible = False
ElseIf Not IsNull([ContactDate]) Then
Me.ContactDate.Visible = True
End If
End Sub[/QUOTE]


Changing the size of a section is only available in AXP and
later versions. Regardless of that, it is better done using
the CanGrow/CanShrink properties. In this case I think all
you need is to set each of those text boxes' and the detail
section's CanShrink property to Yes. Then when you make a
text box invisible it, and its attached lable, will shrink
up the space they're not using. This should be all the code
that's needed:

Me.EMAIL.Visible = Not IsNull(Me.EMAIL)
Me.ContactDate.Visible = Not IsNull(Me.ContactDate)

If the text boxes do not have an attached label, then you do
not need any code at all. A null text box will shrink
automatically.
[/QUOTE]
 
Back
Top