Running total difficulty

1. Senior Member
Join Date
Dec 1969
Posts
190

## Running total difficulty

Hi all,<BR><BR><BR>I have a page displaying filtered records from an Access 2000 database.<BR><BR>it is a repeated row type of display. Each line represents a deal total, I would like to also have a running total as each row repeats.<BR><BR>Where I have 4 columns add together via asp to a deal total. How can I loop through the rows adding each deal total together to get the running total?<BR><BR>I have this right after the repeat code.<BR><BR>&#060;% Dim i, strPageTotal<BR>For i = 1 to 15<BR>strPageTotal = ((rsResults("fldSalePrice")&i)*.00245)<BR>Next<BR> %&#062;<BR><BR>To no avail, there are two tables, the inner table repeats every 15 rows, and the second table repeats the whole page<BR>until the inner table reaches EOF.<BR><BR>Wanted to get a per page total<BR><BR>Thank you for all your help

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## Try SELECT SUM(yourfield) <nm>

boo

3. Senior Member
Join Date
Dec 1969
Posts
190

## RE: Try SELECT SUM(yourfield) <nm>

I know the sum(field) will give me the sum of all of the records for that field - what about running total line by line though?

4. Senior Member
Join Date
Dec 1969
Posts
11,334

## Well

You would just add a var...<BR><BR>Dim runningTotal<BR>For i = 0 to blah<BR>runningTotal = runningTotal + yourValue<BR>Next<BR><BR>runningTotal has your value now.

5. Senior Member
Join Date
Dec 1969
Posts
190

## Not there yet

I&#039;ve got this right inside the loop - it pulls some enormously high value (over 8,400) - I have no idea from what, there should be only one figure of 12.25 - the rest of the records should show zero. - and then it incriments about \$4.45 for each page - and the remaining pages have no other dollar amount.<BR><BR>&#060;% Dim i,strPageTotal<BR> For i = 1 to 15<BR> strPageTotal = (strPageTotal + (((rsResults.Fields.Item("fldSalePrice").Value)&i) *.00245))<BR> Next<BR>%&#062;<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•