NumRecADO




Function GetTotalRecords(ByRef aRS As ADODB.Recordset) As Long
On Error Goto handelgettotalrec
Dim adoBookM As Variant 'Declare a variable to keep the current location
adoBookM = aRS.Bookmark 'Get the current location in the recordset
aRS.MoveLast 'Move to the last record in the recordset
GetTotalRecords = aRS.RecordCount 'Set the count value
aRS.Bookmark = adoBookM 'Return to the origanal record
Exit Function
handelgettotalrec:
GetTotalRecords = 0'If there's any errors return 0
Exit Function
End Function Inputs:A ADODB.Recordset structure

Returns:A Long integer with the total number of records










( numrecado.html )- by Paolo Puglisi - Modifica del 17/12/2023