
RecordCount property always returns -1
Hi,
I'm trying to open a connection to an Access2000 database. The recordset
rsCDs seems to open ok (i can access existing values from the database and
add new records) however, every time i use the RecordCount property is
returns -1, even though there exists records in the table. Here is my code
below:
Dim cnnCD As ADODB.Connection
Dim rsCDs As ADODB.Recordset
Set cnnCD = New ADODB.Connection
Set rsCDs = New ADODB.Recordset
Dim sConnect As String
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\Documents and Settings\oem1\My
Documents\CD_Manager.mdb"
cnnCD.Open sConnect
rsCDs.Open "Select * From CDs Order by IDNumber", cnnCD, adOpenDynamic,
adLockOptimistic
Msgbox rsCDs.RecordCount
How can i return the real number of records in the recordset?
Thanks,
Dave.