Recordcount giving -1 with dbopendynamic

S

Shaleen Chugh

Hi,

I am connecting MS access front end to SQLserver 2000 backend.
When I use this command within my code
Set Tbl1 = db1.OpenRecordset("select * from RecordCounts", dbOpenDynamic)

Debug.print Tbl1.recordcount

Its giving -1, Any leads why this is happening and how to get the record
count for the table?

Thanks,

Rgds,
Shaleen
 
V

Van T. Dinh

Are you using the ODBCDirect WorkSpace?

"dbOpenDynamic" should only be used with ODBCDirect WorkSpace.

Check Access VB Help on the OpenRecordset Method.
 
D

dva

I don't know why this happens (it has happened to me many times, and
couldn't figure out why) but try executing "select count(*) from
RecordCounts". This works all the times.
 
Top