?
Solved

Addition with record results

Posted on 2004-11-08
2
Medium Priority
?
166 Views
Last Modified: 2010-04-25
Ok, I have an ASP app I'm building. I have a page that returns results from an Access database based on some variables from a form. One of the fields it returns is "hours worked", and I want to add the hours from all the returned records, but I don't know where to start.

For example: Search for records between a certain date range, completed by a certain staff member. It returns 5 records and the hours worked are: 1.5, 2.5, 8.0, 5.0 and 3.5 for each record returned respectively. I'd like to add all of those up to show total hours worked as 20.5 hrs. Thanks for the help.
0
Comment
Question by:Ellis_Juan
2 Comments
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 375 total points
ID: 12530229

in You Asp Loop Through them and Add them to sum up

 While not Rs.eof

  TotalHours = Rs("Hours") + TotalHours

 Rs.movenext
 wend

Response.write TotalHours
0
 

Author Comment

by:Ellis_Juan
ID: 12534527
Thanks, that almost worked perfect. I just needed to change it slightly because it wasn't adding the values, it was just placing them next to each other.

I did this:

While not reports.eof

  TotalHours = abs(reports("work")) + abs(TotalHours)

 reports.movenext
 wend
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question