Link to home
Start Free TrialLog in
Avatar of GPSPOW
GPSPOWFlag for United States of America

asked on

MS-Access: Repeating Group headers on subsequent pages

I have a report built in MS-Access which works pretty well.  It has a Nested Groups.  

VisitID (Main group)  - do not keep group together on one page
     CategoryID -            keep header and first record together on one page
        NoteID  -               keep header and first record together on one page
                  Detail




There is a Page Header with the report title information which repeats on every page.

The Main Group is the VisitD.  There is a Header and Footer area.  I have the patient information in the Header area and I do not keep group together on one page.  I want the Header information to repeat on the subsequent pages.

Every subsequent page within the Main Group does not have a header.  The header only prints again when the VisitID changes.

How can make it print?

Thank you

Glen
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You may achieve this by:
Have a public variable inGroup as Boolean.
Set its value to true when group is processed.
Set its value to false when group footer is processed.

In Page header, add group header info.
In page header format event, check for inGroup: if false show group header info, otherwise hid group info.

Option Compare Database
Public inGroup As Boolean

Private Sub GroupFooter2_Format(Cancel As Integer, FormatCount As Integer)
    inGroup = False
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
    inGroup = True
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
    ghl.Visible = fslse
    If inGroup Then
        ghl.Visible = True
    End If
End Sub

Open in new window


Check this demo database.
Open Report1 in Print Preview
repeat-group-info.accdb
Avatar of GPSPOW

ASKER

Thank that did the trick.

Glen