Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems


ADO Recordset Object AbsolutePage Property

Specifies in which page the current record resides.

AbsolutePage Property Return Values

Sets or returns a Long value from 1 to the number of pages in the Recordset object (PageCount), or returns one of the following constants:




The recordset is empty, the current position is unknown, or the provider does not support the AbsolutePage property


The current record pointer is at BOF (that is, the BOF property is True).


The current record pointer is at EOF (that is, the EOF property is True).

AbsolutePage Property Remarks

Use the AbsolutePage property to identify the page number on which the current record is located. Use the ADO Recordset Object PageSize Property to logically divide the Recordset object into a series of pages, each of which has the number of records equal to PageSize (except for the last page, which may have fewer records). The provider must support the appropriate functionality for this property to be available.

Like the AbsolutePosition property, AbsolutePage is 1-based and equals 1 when the current record is the first record in the recordset. Set this property to move to the first record of a particular page. Obtain the total number of pages from the ADO Recordset Object PageCount Property.

AbsolutePage Property Example

This Visual Basic example uses the AbsolutePage, PageCount, and PageSize properties to display names and hire dates from the Employees table five records at a time.

Public Sub AbsolutePageX()

Dim rstEmployees As ADODB.Recordset

Dim strCnn As String

Dim strMessage As String

Dim intPage As Integer

Dim intPageCount As Integer

Dim intRecord As Integer

` Open a recordset using a client cursor

` for the employee table.

strCnn = "driver={SQL Server};server=srv;" & _


Set rstEmployees = New ADODB.Recordset

` Use client cursor to enable AbsolutePosition property.

rstEmployees.CursorLocation = adUseClient

rstEmployees.Open "employee", strCnn, , , adCmdTable


` Display names and hire dates, five records

` at a time.

rstEmployees.PageSize = 5

intPageCount = rstEmployees.PageCount

For intPage = 1 To intPageCount

rstEmployees.AbsolutePage = intPage

strMessage = ""

For intRecord = 1 To rstEmployees.PageSize

strMessage = strMessage & _

rstEmployees!fname & " " & _

rstEmployees!lname & " " & _

rstEmployees!hire_date & vbCr


If rstEmployees.EOF Then Exit For

Next intRecord

MsgBox strMessage

Next intPage


End Sub

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.