Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page count in Group

Status
Not open for further replies.

dixxy

Technical User
Mar 4, 2003
220
0
0
CA
Hello,

I would like to know if there is a way to count the number of pages in all the groups of a Report.

So in other words I have a Report, that gets broken up into 3 different groups. Each group being printed on a different sheet. The reason I need this, is that I would like to hide the page header on the first page of every group, and hide the group header of every other page in the group (if the groups has more than one page).


So I am thinking like this:

in the group header have a text box 'txtGroupNumber' with control source '=1' and set it to running sum. So far that works good. Now what I need is a page of pages for each group.
Then I could check with code:
Code:
if txtGroupNumber = 1 then
 If page 1 of group then
  PageHeader.visible=false
  GroupHeader.visible=true
 end if
 If page 2 of group then
  GroupHeader.visible=false
  Page header visible = true
 End if
End if

Then repeat the code for every group

Is there a way of doing this?




Thanks,

Sylvain
 
Sylvain,

On the grouping header on_format event if you set the page to 1
i.e. Page = 1
you can then in the next line do an If statement to say that if Page equals 1 then make the page header visible equal false.

Hope this is what you were after

Jonathan
 
Jonathan,

This sounds like something that could work. I just need a little more info about this 'set page to 1' Do you mean a text box? What would be it's control value?
What would the code be?


Thanks,

Sylvain
 
You just type

Page = 1

in the format event of the group level header (click the header that splits your report int o three groups and then in the properties under the events tab, add an events procedure for the format event).

This then resets the page number to 1 every time the group is formated (in your case 3 times)

You can then add the following code in the format event of the detail section

if Page = 1 then
PageHeader.visible=false
GroupHeader.visible=true
else
GroupHeader.visible=false
Page header visible = true
End if


I hope this makes sense but it is hard to explain.

Jonathan
 
Jonathan,

We are getting close, I added code in the GropupFooter like this : Page = Page + 1,
because otherwise on the second page of the first group (So group 1 page 2) the page number is still 1.

Now the only problem is that with all this it also resets the report page numbers, which is not good.
ei: on page 3 of the report the
Code:
'="Page " & [Page] & " of " & [Pages]'
goes back to 1 of 6, when it should say 3 of 6.

I hope I explain myself clearly enough...

Thanks,

Sylvain
 
Sylvain,

Sorry but I did not know that you wanted to maintain an overall 'Page? of ?' aswell.

Sorry I have not tackled that one. You can try the following site that says it does what you want (with a bit of changing the code to hide your headers)


Sorry I could not help further

Jonathan
 
Hello Dixxy,
There may be another solution to this problem. Presumably, you already know how many rows will fit onto one of your formatted pages, correct? You will be able to place code into the On Format event in the Page Header that will use the DCount function to count the number of rows that will be retrieved for that particular group. A simple calculation will reveal the number of pages needed.

For example, let's say your page contains 50 rows. Your DCount finds that customer #12345 has 122 rows to print. The total page count then becomes 3. Make sense?

HTH, [pc2]
Randy Smith, MCP
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top