Not going to next record

J

jimati

I always have better luck with:

Do While Not RS.EOF

I also don't think you need to rs.movelast. Just
rs.movefirst to get you to the first record.
 
D

Dirk Goldgar

jimati said:
I always have better luck with:

Do While Not RS.EOF


"Do While Not RS.EOF" is exactly the same, functionally, as "Do Until
RS.EOF". There's nothing to choose between them, except that, IMO,
logic couched in positive terms is easier for people to understand than
logic expressed in negative terms.
I also don't think you need to rs.movelast. Just
rs.movefirst to get you to the first record.

Actually, in this case you don't need either of them (since the newly
opened recordset will always be positioned at the first record, if there
is one). In fact, the code will be more secure with neither .MoveLast
nor .MoveFirst before the loop, because if the recordset is empty,
RS.MoveFirst and RS.MoveLast will both raise an error.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
[remainder snipped]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top