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
while not datcheck.recordset.eof
 total = total + amt
this worked for the date field... but i want the amt field
any suggestions
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

total = total + datcheck.recordset.fields("amt")

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

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.

Maybe you should reject my answer and allow entretec to answer (with an example).
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.