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!
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!
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]
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.
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]
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.