How do you add values together?

1. Senior Member
Join Date
Dec 1969
Posts
118

How do you add values together?

Hi,<BR><BR>I have a numerical sales field repeated on a results page. How would I get the total value of all the values returned in my recordsets results.<BR><BR>i.e.<BR><BR>Sales <BR>12<BR>13<BR>22<BR><BR>Total<BR>11<BR><BR>Thx<B R><BR>Sip :o)<BR>

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

You serious?

You think that 12 + 12 + 22 = 11?<BR><BR>You&#039;ve got bigger problems than you realize.<BR><BR>Give up programming. It&#039;s just going to cause you heartache.

3. Senior Member
Join Date
Dec 1969
Posts
16,931

RE: You serious?

No, he thinks that 12 + 13 + 22 = 11.<BR><BR>Maybe you should go for a lie-down too?<BR><BR>:-)<BR><BR>Craig.

4. Senior Member
Join Date
Dec 1969
Posts
118

It&#039;s so nice to get a pro active response from a jerk off every now and then. The fact it&#039;s an example doesn&#039;t really matter whether I can count or not does it? <BR><BR>Probably explains why I&#039;m trying to find a dynamic way to do it to avoid accidental mistakes such as this.

5. Senior Member
Join Date
Dec 1969
Posts
118

RE: You serious? Lol doesn't effing matter wh

Lol doesn&#039;t effing matter what the numbers are

6. Senior Member
Join Date
Dec 1969
Posts
16,931

Relax.

He was pulling your leg.<BR><BR>If you JUST want the count, I suggest looking up SUM(). If you want the results as well as the count, then why not just have a variable that you increment?<BR><BR>Dim dblTotal: dblTotal = 0<BR>do while objrs.eof = false<BR> dbltotal = dbltotal + cdbl(objrs.fields("total"))<BR> objrs.movenext<BR>loop<BR><BR>ad infinitum.<BR><BR>Craig.

7. Senior Member
Join Date
Dec 1969
Posts
16,931

Come on man, it was a joke. <eop>

.

8. God
Senior Member
Join Date
Dec 1969
Posts
18,177

Oh, now you hurt my feelings.

It was a JOKE. Get over it.<BR><BR>Besides - you ask the most simple questions anyway. That I wouldn&#039;t help you anyhow.<BR><BR>Think about a simple example - you have 2 numbers, how do you assign the sum of those numbers to a variable?

9. Senior Member
Join Date
Dec 1969
Posts
118

RE: Come on man, it was a joke. <eop>

Too tired for jokes at the mo... Soz... had no sleep for 3 day&#039;s

10. God
Senior Member
Join Date
Dec 1969
Posts
18,177

"why not just have a variable ..."

Because SIMPLE ASP programming seems too advanced for him.<BR><BR>Today it was how do I add numbers.<BR><BR>Yesterday was, how do I write a Loop.<BR><BR>The day before was....<BR><BR>ad infinitum.<BR><BR>We&#039;re doing the guy&#039;s work.<BR><BR>Craig - you&#039;re doing all the work, but receive none of the pay.

Posting Permissions

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