Can anybody please tell me why the RecordCount property returns a -1 in th last line of this code? There are two records in the 'CA' table and I'm using Access 2002.
strCnn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentDb.Name
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
' Open CA table.
Set rstCA = New ADODB.Recordset
rstCA.CursorType = adOpenDynamic
rstCA.LockType = adLockPessimistic
rstCA.Open "CA", cnn1, , , adCmdTable
rstCA.MoveLast
rstCA.MoveFirst
intTotalRec = rstCA.RecordCount
Thanks.
strCnn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentDb.Name
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
' Open CA table.
Set rstCA = New ADODB.Recordset
rstCA.CursorType = adOpenDynamic
rstCA.LockType = adLockPessimistic
rstCA.Open "CA", cnn1, , , adCmdTable
rstCA.MoveLast
rstCA.MoveFirst
intTotalRec = rstCA.RecordCount
Thanks.