> I have query that returns approx 2500 records.  The fields are
> name, address, amount due, interest etc.  At the bottom of my
> display page I would like to add up all the values in the amount
> due, and add up all the interest amounts etc.
>
> I have done math on two or three variables but never on so many
> values. Can anyone point me in the right direction.

Well, Mike, there are really two ways of doing this.

Either as you loop on the query to display it you add up all the columns in
different variables, like:

fTotalAmountDue = fTotalAmountDue + qry.amountDue[currentRow];
fTotalInterestAmount = fTotalInterestAmount +
qry.interestAmount[currentRow];

And use these variables to display at the end of the page.

The other solution is to do a second query :

SELECT SUM(amountDue) as TotalAmountDue
       SUM(interestAmount) as TotalInterestAmount
[SAME FROM CLAUSE AS INITIAL QUERY]
[SAME WHERE CLAUSE AS INITIAL QUERY]


And display qry2.TotalAmountDue and qry2.TotalInterestAmount.

Hope this helps...


Marc Campeau
----------------------
Senior Software Engineer
Vertabase Pro - Project Management Tools
http://www.vertabasepro.com

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Marc Campeau" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to