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!

How Can I Add total Lines on a Report HELP!!!!

Status
Not open for further replies.

Jack58

Technical User
May 6, 2002
91
0
0
US
How can I simply place a total line count on my report for the lines contained on the report page.

Whatever I try I am getting a count by line with a total count, I only want a count at the bottom of each page on my report of the total of lines per page.

Hope someone can help!!!!

Jack
 
This can be done with just a little bit of code........

Add an unbound text box to your detail section (for example, txtCount) and set it to be invisible.

In the On Format event of your page header section, put the following code:
Code:
txtCount = 0
This will reset the variable to 0 for each new page.

In the On Format event of your detail section, put the following code, of course changing txtFieldToBeCounted to your field to calculate:
Code:
txtCount = txtCount + 1

Add a text box to your page footer to display the page total. Set its control source to =[txtCount] which holds the last amount.
 
I have a report with several memo fields, each with multiple lines. I tried as CosmoKramer explained and I get a prompt for the txtCount. When I removed the initialize out of the page header section, I only get "0".
 
You can only get totals if the formula is placed in the Report Footer section. What you have to do is create an unbound textbox control and set the ControlSource to something like this:

=Count([YourPrimaryKeyField])

I would recommend counting your primary key since a new record cannot exist without it which would provide a much accurate count. Make sure it is placed in the detail section of a continuous report. If you don't want the primary key field to be seen, just set the visible property to 'No'. Even though it is not visible, Access still counts it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top