troubleshooting Question

Reset end of file DAO recordset

Avatar of MichMat
MichMat asked on
Visual Basic.NET
2 Comments1 Solution805 ViewsLast Modified:

I have a DAO recordset , I want to know the number of records it contains before I start procesing it, so I use a loop to count the records first (PLEASE IF THERE IS A BETTER WAY OF COUNTING RECORDS in a DAO recordset then please let me know.

The problem is that using the loop when I know the number of records the EOF is set at end of file so when it comes to iterate through the recordset to do the ACTUAL procesing I just get moved past the loop because the file is at EOF

Thank you


cnt = 0
            Do While Not ar.EOF
                cnt = cnt + 1
'Here I have the record count in cnt but the EOF is set at end
            Do While Not ar.EOF
                RN = ar.Fields(0).Value
                ar.Fields(25).Value = "Y"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros