summing a recordset

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
csmAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
clifABBConnect With a Mentor Commented:
total = total + datcheck.recordset.fields("amt")
0
 
entretecCommented:
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
 
clifABBCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.