Show count of record lines per page in report

Wb999
NewLounger
Posts: 16
Joined: 19 Sep 2013, 22:00

Show count of record lines per page in report

Post by Wb999 »

I have a report which limits the record lines to 30 per page.
The last page of the report may have fewer than 30 records.
I need to show a count of records per page which can either be making the count text box visible or by having a count in the page footer.

Am struggling to do either of these. It doesn't matter which option is used, whichever is the easiest to do.

Could someone help with :
1. resetting the counter to 1 when the report runs to more than 1 page, or
2. having a count of records per page in the page footer

Thanks in advance

User avatar
HansV
Administrator
Posts: 78588
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Show count of record lines per page in report

Post by HansV »

Create a text box in the Detail section of the report with the following properties:

Visible: No
Control Source: =1
Running Sum: Over All
Name: txtRecordCount

Create another text box in the page footer section with the following properties:

Name: txtPageCount

Create an On Print event procedure for the page footer section:

Code: Select all

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
    Static lngNumRec As Long
    Me.txtPageCount = Me.txtRecordCount - lngNumRec
    lngNumRec = Me.txtRecordCount
End Sub
Best wishes,
Hans