Group header format problem

J

Jake

I would like a group header not to show only for the first record and then
show that header for rest of the report. The following code works:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If lngTenCount.Value = 1 Then ' lngTenCount is a unique counter field
identifying 1st record that suppresses header
GroupHeader0.Visible = False
Else
GroupHeader0.Visible = True
End If
End Sub

But it doesn't turn the header back on after the first record. It displays
the header when another field in the group changes around record 9. What am
I doing wrong? Thanks for you help!
Jake
 
G

Guest

Hi Jake,

A few things I can think of are:

The group header prints when there's a new group so your lngTenCount.Value
remains one until the 9th record because a different group is printed at the
9th record. Try incrementing the counter in the detail section instead. It
sounds as if your program goes like this:

1 - X header NOT printed 'lngTenCount.Value = 1
2 - X detail printed 'lngTenCount.Value = 1
3 - X detail printed 'lngTenCount.Value = 1
4 - X detail printed 'lngTenCount.Value = 1
5 - X detail printed 'lngTenCount.Value = 1
6 - X detail printed 'lngTenCount.Value = 1
7 - X detail printed 'lngTenCount.Value = 1
8 - X detail printed 'lngTenCount.Value = 1
9 - Y header PRINTED 'lngTenCount.Value = 2
9 - Y detail printed 'lngTenCount.Value = 2

You see in the above example your counter only increments when the group
changes. If you set your counter in the detail section, it will increment as
each detail is printed instead of as each header is printed.


Hope this helps,
RF
 

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