Tackle message Recordcount = -1 when usi

wxdqz

New Member
Hello
People using ADO to retreive records from a database often donot get the correct record count...This is because the cursor type of the database they use by default would be a forward only cursor....

Following is a workaround to tackle this problem
You need to Change your cursor type at the time of specifying your recordset
A sample code is given below

Set condb = application.CreateObject("ADODB.Connection")
condb.Open "eazy", "CBSI_EAZY", "CBSI_EAZY"
Set rs = application.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3

After running this connection code...if you try to retreive the record count through the statement rs.recordcount, you will get the exact count for the DB
Hope this helps

Thanks
Soundar
 
Back
Top