Setting GroupHeaders Top Property

E

Eddy

I use the following code to determine the top of each control that will
print in Groupheader3. I take the Top value of the lowest pirnted control
(in the section) add a number to it and try to set the GroupHeader.Top
value. My attempt is to minimize the size of the GroupHeader to only big
enought to show the visible data. This code is behind the On Format event
of the header.

If IsNull(ctl) Or ctl.Value = 0 Then
ctl.Top = 0
End If
If ctl.Top > strTop Then
strTop = ctl.Top
End If

Next ctl
GroupHeader3.Height = strTop + 0.15



The problem is the GroupHeader Top value does not change when I try to set
it. It remains what it always was. Is this code or my thinking faulty or
maybe the groupheader top value can not be set.
Thanks.
 
M

Marshall Barton

Eddy said:
I use the following code to determine the top of each control that will
print in Groupheader3. I take the Top value of the lowest pirnted control
(in the section) add a number to it and try to set the GroupHeader.Top
value. My attempt is to minimize the size of the GroupHeader to only big
enought to show the visible data. This code is behind the On Format event
of the header.

If IsNull(ctl) Or ctl.Value = 0 Then
ctl.Top = 0
End If
If ctl.Top > strTop Then
strTop = ctl.Top
End If

Next ctl
GroupHeader3.Height = strTop + 0.15



The problem is the GroupHeader Top value does not change when I try to set
it. It remains what it always was. Is this code or my thinking faulty or
maybe the groupheader top value can not be set.


I think A2002 is the first version that allows you to set
the height of a section in its Format event.

From what you've explained so far, there is no need for all
this fooling around. You can use each control's and their
Section's CanShrink property to squeee out the unused space.
Any text box that is invisible, has a value of Null or a ZLS
will shrink to zero height. If there are no other unshrunk
controls in the same horizontal band, the section will also
shrink up the white space left by the shrunk text boxes.

To make a text box with a value of zero shrink, change its
control source to an expression like:
=IIf([field] = 0, Null, [field])

If a text box has an attached label, you will, in addition
to the above, have to use a little code to make the text box
invisible (which will make it's label invisible too).
Me.textbox.Visible = (Nz(Me.textbox, "") <> "")
 

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