report detail section

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
 
M

Marshall Barton

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.
 
G

Guest

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top