ADO MaxRecords Property

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

ADO MaxRecords Property

The MaxRecords property sets or returns a long integer that dictates the maximum number of records that a query can return. This can be useful when you do not know how many records might be returned by a query to a very large database. The default is zero which signifies that there is no maximum limit.

This value is passed to the provider and it is the responsibility of the provider to implement this limit. Note, this property has no effect on an Access database.

You can only set this property when the Recordset is closed (read/write when closed, read-only when open). Not all providers recognize this property.

Syntax

objRecordset.MaxRecords

Example

set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "F:\Mydata\northwind.mdb"
set rs = New ADODB.recordset
rs.MaxRecords=20
sql="SELECT * FROM Customers"
rs.Open sql,conn
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing