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

asp sum field value

Status
Not open for further replies.

stpmtp

MIS
Jan 6, 2006
67
US

Hello,
How can I sum the value of different fields
Code:
<if rsone ("sm")= rsone ("bn")then rsone ("sm").value = "3" else rsone ("sm").value = "0" end if %>
I have this for about 10 fields sm1,sm2,etc.

I would like to sum the value of sm1,sm2,sm3, etc.

how could I do this?
 
do a for loop
(this will be jscript)

Code:
var totalValue = 0
for (a = 1; a < 10; a++) {
   if rsone ("sm + 'a' + ")= rsone ("bn + a + ")then rsone 
      ("sm + 'a' + ").value = "3" else rsone ("sm + 'a' + ").value = "0" end if %>
   totalValue += rsone("sm + 'a' + ")
}


<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top