Loop through report GroupHeaders at runtime

D

dave

We want to allow users of one of our databases to insert page breaks at
certain points in a report and these choices are stored in Yes/No
fields in a table; the fields are called "Sub1", "Sub2", "Sub3" etc.
through to "Sub8". In the report itself, there are nine Groupheaders
all grouped on the same ID field.

Each Groupheader has a tag with the same name as a field in the table
described above. I want to loop through each Groupheader in the
report's OnOpen event and set ForceNewPage=2 where the table field
corresponding to the tag in the Groupheader = Yes.

The only thing that seems to work is a "hard-coded" attempt e.g
Me.GroupHeader4.ForceNewPage = 2

Another solution could be to be to loop through the datatable and:

if Sub1=-1 then
Me.GroupHeader1.ForceNewPage = 2
end if

if Sub2=-1 then
Me.GroupHeader2.ForceNewPage = 2
end if

I really want to avoid this as it seems clumsy and we have about 20
reports to apply this too although I guess we could make a public
function and refer to it from each report.

If anybody has any ideas on how to achieve this more elegantly I would
be very interested to hear them.

Thanks in advance.

Dave R.
 

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