Hello Folks,
This seems to be a common problem, but I can't find a thread which provides an answer for my situation.
I have a program which uses a single procedure to open a recordset:
rs.Open sSql, cnDb, adOpenStatic, adLockOptimistic
(sSQL is a sql variable).
The database may be a Jet 3.5.1, Jet 4.0 or SQL Server. For the first two db types, the recordcount is returned as expected, but for the SQL Server version, it's always -1, even though records may successfully be returned.
I've tried every combination of parameters - replacing adOpenStatic with adOpenKeySet and adLockOptimistic with adlockpessimistic, but it's still returning a recordcount of -1.
Hopefully I'm missing something simple, so help here would be appreciated!
This seems to be a common problem, but I can't find a thread which provides an answer for my situation.
I have a program which uses a single procedure to open a recordset:
rs.Open sSql, cnDb, adOpenStatic, adLockOptimistic
(sSQL is a sql variable).
The database may be a Jet 3.5.1, Jet 4.0 or SQL Server. For the first two db types, the recordcount is returned as expected, but for the SQL Server version, it's always -1, even though records may successfully be returned.
I've tried every combination of parameters - replacing adOpenStatic with adOpenKeySet and adLockOptimistic with adlockpessimistic, but it's still returning a recordcount of -1.
Hopefully I'm missing something simple, so help here would be appreciated!