Count records to page header

IpeXeuS

Registered User.
Local time
Today, 14:27
Joined
Nov 23, 2006
Messages
98
Hello,

I was wondering is there a way how I can calculate how many records there's in the report and not in table to page header text field? All advices are welcome and approciated!, thanks!
 
Hello,

I was wondering is there a way how I can calculate how many records there's in the report and not in table to page header text field? All advices are welcome and approciated!, thanks!

Put a text box to the the report header or report footer section, Control source: =Count([name of any text box in the detail section])

Dont put it to the page header or page footer section because it works wrong.
 
Yes, I'm well known of that thanks anyway, but how can I make it that it's in each page and not just first or last page of report? :)
 
Try this - I just tested this and it worked for me:

put a text box into the details section and name it txtCount and then in the recordsource put =Count([YourFieldNameHere]) then make it's visible property No.

Then, put a text box in the page header and set the controlsource to =[txtCount]
 
Yes, I'm well known of that thanks anyway, but how can I make it that it's in each page and not just first or last page of report? :)

Try to do this way (I'm not sured):
In class module of report, you declare a variable named cnt:
Dim cnt As Integer

In Detail_Print event procedure, you put this:
cnt = cnt + 1

In PageHearderSection_Print or PageFooterSection_Print base on you want to show the count of records per page, you put this:
[txtCount] = "Records/page: " & cnt
cnt = 0

txtCount is the text box will show the count of records.
:D
 
Try this - I just tested this and it worked for me:

put a text box into the details section and name it txtCount and then in the recordsource put =Count([YourFieldNameHere]) then make it's visible property No.

Then, put a text box in the page header and set the controlsource to =[txtCount]

This worked for me as well, approciate. :D
 
A comment on phatnq2002's otherwise excellent post.

Putting the statement [txtCount] = "Records/page: " & cnt in PageHeaderSection_Print will result in your tallied count being applied to the header of the following page vice the current page.

The reason for this is that the PageHeaderSection_Print event is encountered (an thus set) prior to the cnt = cnt + 1 statement iteration in the Detail_Print event.

Recommend putting the [txtCount] = "Records/page: " & cnt statement in PageFooterSection_Print.
 

Users who are viewing this thread

Back
Top Bottom