ADO PageCount Property

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO PageCount Property

The PageCount property returns a long value that indicates the number of pages with data in a Recordset object.

Tip: You use the PageSize property to determine how many records will be displayed on each page.

Note: If the last page contains fewer records than specified in PageSize, it still counts as an additional page in the PageCount property.

Note: If the provider does not recognize this property, a value of -1 will be returned.

Syntax

objRecordset.PageCount

Example

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset, i As Integer

set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "F:\Mydata\northwind.mdb"
set rs = New ADODB.recordset
sql="SELECT * FROM Customers"
rs.Open sql,conn
rs.PageSize=5
i=rs.PageCount
MsgBox ("The number of pages in RS = " & i)
rs.Close
conn.Close
set rs = Nothing
set conn = Nothing