Header height by code

G

George

Dear friends,

I have a report for printing certificates of attendance (groupped by
Employee No). Each employee may have attended 1 - 10 trainings. I need to
show the details of the trainings in the middle (verrtical) of the page. So,
e.g. when the employee has attended 1-5 trainings, then the page header size
(height) must be 5cm, Else should be 2 cm.

Any ideas?

Thanking you in advance,

GeorgeCY
 
F

fredg

Dear friends,

I have a report for printing certificates of attendance (groupped by
Employee No). Each employee may have attended 1 - 10 trainings. I need to
show the details of the trainings in the middle (verrtical) of the page. So,
e.g. when the employee has attended 1-5 trainings, then the page header size
(height) must be 5cm, Else should be 2 cm.

Any ideas?

Thanking you in advance,

GeorgeCY

If I remember correctly, the Page Header size cannot be set or re-set
during the running of the report.
 
M

Marshall Barton

George said:
I have a report for printing certificates of attendance (groupped by
Employee No). Each employee may have attended 1 - 10 trainings. I need to
show the details of the trainings in the middle (verrtical) of the page. So,
e.g. when the employee has attended 1-5 trainings, then the page header size
(height) must be 5cm, Else should be 2 cm.

If that can be done. it would have to use code in the page
header's Format event, but you may have trouble getting the
number of details there.

If not, you can create another group on the same employee
field as your existing employee group. Don't put any
visible controls in this group header section and use code
in it's Format event to adjust its size. To determine the
height to use, add a hidden text box (named txtNumDetails)
to the group header and set its expression to =Count(*)
Then use code to check and set the section's Height.

If Me.txtNumDetails <= 5 Then
Me.Section(7).Height = 5 * TPC 'twips per centimeter
Else
Me.Section(7).Height = 2 * TPC 'twips per centimeter
End If
 
G

George

Marshall, thanks a lot for the reply,

Well, I have use the following code (1 detail or >1 detail):

If Me.txtNumDetails = 1 Then
Me.Section(7).Height = 5 * TPC 'twips per centimeter
Else
Me.Section(7).Height = 2 * TPC 'twips per centimeter
End If
End Sub

It seems that works OK for the first page (employee) only. Following
employees, although having 1 detail, Section height doesn´t change.

Any ideas?

George


Ο χÏήστης "Marshall Barton" έγγÏαψε:
 
M

Marshall Barton

George said:
Well, I have use the following code (1 detail or >1 detail):

If Me.txtNumDetails = 1 Then
Me.Section(7).Height = 5 * TPC 'twips per centimeter
Else
Me.Section(7).Height = 2 * TPC 'twips per centimeter
End If
End Sub

It seems that works OK for the first page (employee) only. Following
employees, although having 1 detail, Section height doesn´t change.


I set up a report with one standard group header and an
empty group header. The code in the empty group header's
Format event was what I posted and it work as expected.

The only way I could make the smaller size empty header not
work is if I had a control (visible or not) in the (not
really empty) section that was below the point where I
wanted the smaller section size. Putting the Count(*) text
box in the real group header so the empty group header was
really empty removed even that restriction.

What declaration and how did you set the value of TPC?
 

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