Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'This will display the current record
lblStatus.Caption = "Record: " & CStr(adoPrimaryRS.AbsolutePosition)
'This displays the total of records
lblStatus1.Caption = "Total:" & CStr(adoPrimaryRS.RecordCount)
End Sub
You can forget the whole cursor type debate and just go with a modified SQL.
SELECT Count(*) AS RecordCount
FROM Table1;
This will return the number of records in the table.
ie:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim lRecordCount As Long
Dim sSQL As String
Set cn = CreateObject("ADODB.Connection"
Set rs = CreateObject("ADODB.Recordset"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.