Recordsets

M

miaplacidus

How come the query "EmployeePhones" produces 150 records
but rs = db.openrecordset("EmployeePhones") produces one
record?
 
D

Dan Artuso

Hi,
If you're getting that number from the RecordCount property, make sure you do a
rs.MoveLast before you check it. That will fully populate your recordset.

HTH
Dan Artuso, MVP
 
M

miaplacidus

Oh, Geez. Isn't a recordset a set? If MoveLast works then
why didn't MoveNext work when I was trying to loop through
the set?

What do I do, MoveLast to populate the set then MoveFirst
so I can loop through?
 
D

Dan Artuso

Hi,
Well, you only need to MoveLast if you want to check the RecordCount property.
Otherwise just do a MoveFirst and then start your loop.

HTH
Dan Artuso, MVP
 
G

Guest

Nope, If I just use MoveFirst and then loop through I
only have one record, but if I MoveLast, check the record
count and MoveFirst, then the loop works properly.
 
D

Dan Artuso

Hi,
What is your code?
Is it:
While Not rs.EOF Then ....

Because that should work.

If you're using something like:
For i = 1 to rs.RecordCount -1 ...

You would have that problem.
 

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