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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing the line numbers 1

Status
Not open for further replies.

Zonie32

Technical User
Jan 13, 2004
242
US
is it possible to sum the line numbers in a report footer?

I have my text box name as LineNumber. I set Control source to =1, Running Sum Over All. Now in the footer I would like to tally up the line numbers.

I tried inserting an unbound text box to =sum([LineNumber]) but it is blank. Any help is appreciated. Thanks.
 
Well, you can try this in the Format event for the Detail Section. LNTotal is a textbox in the Report Footer.

Static myVal
myVal = myVal + Me.LineNumber
Me.LNTotal = myVal / 2

Because the report formats twice, you have to divide the final product, myVal, by 2 to get the corrected total.

Paul
 
Summing the line numbers would the same as:

=Count(*)*((Count(*)+1)*0.5)

If there are 5 records, your sum would be:
1+2+3+4+5=15
or
5*((5+1)*0.5)

If you want to count the number of records in your group section, you can use:
=Count(*)

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks dhookom. I did want to count the number of records and =count(*) works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top