?
Solved

summing a recordset

Posted on 1998-06-05
3
Medium Priority
?
262 Views
Last Modified: 2010-05-03
i have a recordset created by a sql statement., the recordset is assigned to a datacontrol
i am trying to find a way to move throught the recordset and sum one of the fields.
i triedthe following code but nothing happen
datcheck.recordset.movefirst
while not datcheck.recordset.eof
 total = total + amt
  datcheck.recordset.movenext
wend
this worked for the date field... but i want the amt field
any suggestions
0
Comment
Question by:csm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 100 total points
ID: 1462658
total = total + datcheck.recordset.fields("amt")
0
 

Expert Comment

by:entretec
ID: 1462659
Why not create a SUM query for the field you wish to add up?

Use Access to create the SUM create and call this for your DAO recordset

MikeB
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1462660
entretec:
What a grand idea.  Normally I would have done it that way.  I guess I was just basing my answer on the example csm gave.

csm:
Maybe you should reject my answer and allow entretec to answer (with an example).
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

764 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