calculate total column value

# Thread: calculate total column value

1. Member
Join Date
Dec 1969
Posts
52

## calculate total column value

I need to calculate the total value of a number of strings selected from a query. The query statement is:<BR><BR>strSQL = "SELECT * FROM orders WHERE purchordno &#060;&#062; orderedby" <BR><BR>and the report displays the following fields:<BR><BR>Response.write "&#060;td bgcolor="& currentColor &"&#062;&#060;font face=Arial size=2&#062;"& RS("purchordno") &"&#060;/td&#062;"<BR>Response.write "&#060;td bgcolor="& currentColor &"&#062;&#060;font face=Arial size=2&#062;"& RS("orddt") &"&#060;/td&#062;"<BR>Response.write "&#060;td bgcolor="& currentColor &"&#062;&#060;font face=Arial size=2&#062;"& RS("supnames") &"&#060;/td&#062;"<BR>Response.write "&#060;td bgcolor="& currentColor &"&#062;&#060;font face=Arial size=2&#062;"& RS("fulldetails") &"&#060;/td&#062;" <BR>Response.write "&#060;td bgcolor="& currentColor &"&#062;&#060;font face=Arial size=2&#062;"& RS("totalcost") &"&#060;/td&#062;"<BR><BR>I need to calculate the total of all the &#039;total cost&#039; fields....is there a way?!<BR><BR>Thanks

2. Member
Join Date
Dec 1969
Posts
96

## RE: calculate total column value

Somthing like this:<BR><BR>Dim totalcost<BR>totalcost = 0<BR>rs.movefirst<BR>do until rs.Eof<BR> Response.write .......<BR>...........<BR>........<BR>........<BR> totalcosts = totalcost + rs("totalcost")<BR>rs.movenext<BR>loop<BR><BR> <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
•