I have a view in SQL server (VIEW_TRIP_DATES). I am using Microsoft access to calculate the number of records in this table. While I can browse the recordset, I get -1 with the recordcount property. Am I missing something here?
Thanks
Public Function GetADOConn() As ADODB.Connection
Dim conn As ADODB.Connection
Dim adoConn As String
Set conn = New ADODB.Connection
adoConn = "Provider='SQLOLEDB';Data Source='co-nt-dmn6';" & _
"Initial Catalog='FLD';Integrated Security='SSPI';"
conn.Open adoConn
Set GetADOConn = conn
End Function
MyCode sub
Set rst = New ADODB.Recordset
rst.Open "SELECT TRIP_DATE FROM VIEW_TRIP_DATES", GetADOConn, adOpenForwardOnly
Debug.Print rst.RecordCount 'returns -1
rst.MoveNext
Debug.Print rst.RecordCount 'this also returns -1
end sub
Thanks