Linked Table Record Count correct?

G

Gilbert 2097

I've been learning about linked tables ( splitting my mdb's to front & back
end) and I remember reading some place that the record count property always
comes out -1. I'm not sure if they meant actualcount -1 or the value -1. I
use recordcount in decision making a couple of times and I was wondering if
anybody knows about a problem with this. Maybe it was an old article and the
problem has been fixed.?. Can someone please let me know if they've heard of
this b/4 and if there is a solution?? Thanx
 
D

Duane Hookom

To get an accurate count of the number of records in a recordset, you should
use something like:
rs.MoveLast
lngRecordCount = rs.RecordCount
rs.MoveFirst
 
D

david epsom dot com dot au

When linked to SQL Server, using ODBC, there are some
kinds of recordsets that will not and do not return
a recordcount: all you get is -1.

All other recordsets return 0 (empty), 1 (1 or more
records), or n (n records have been read from the
database).

If your recordset has a record count of 1 or more,
move to the end of the recordset to make sure all
records are read.

If your recordset has a record count of -1, choose
a different kind of recordset to get a record count.

(david)
 
G

Gilbert 2097

Thanx for the input guys!! It must have been that special case in ODBC that
I remembered reading about. I have read and do know that to get an accurate
recordcount you need to populate the recordset first ( I think it said the
records weren't actually made up until you needed one ??) and of course
movelast would do that. So you're saying that if I'm using an ordinary
recordset in Jet (nothing odd) that it will always return the correct # of
records?? Thanx again
 
D

david epsom dot com dot au

Well, except if somebody just entered the record:
then you have to wait until the record is written
back to the database, then wait until it is read
from the database into your record cache.
It may take 5 or more seconds until you get the
new record, and of course you won't be able to
read it or count it until you get it. But yes,
the record count always returns the number of
records you currently have - and if you move last
you always have all the records you can find.

(david)
 

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