PROPERTY:  Recordset::MaxRecords

long = recordsetobject.MaxRecords
recordsetobject.MaxRecords = long


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.

In this example, only the first five records are returned even though the query string selects all records in the table:

Code (VBScript):
Set rsChants = Server.CreateObject("ADODB.Recordset")
rsChants.MaxRecords = 5
strQuery = "SELECT * FROM GuruChantList"
rsChants.Open strQuery, , , adCmdTable

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information