Share via


MaxRecords Property [Access 2003 VBA Language Reference]

Specifies the maximum number of records that will be returned by:

  • A query that returns data from an ODBC database to an Microsoft Access database (.mdb).
  • A view that returns data from a SQL database to an Access project (.adp).

expression.MaxRecords

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

The MaxRecords property setting is a Long Integer value representing the number of records that will be returned.

In a Microsoft Access database, you can set this property by using the query's property sheet or Visual Basic .

When you set this property in Visual Basic you use the ADO MaxRecords property.

Records are returned in the order specified by the query's ORDER BY clause.

You can use the MaxRecords property in situations where limited system resources might prohibit a large number of returned records.

Example

To return the MaxRecords property for a form, you can use the following:

Dim l As Longl = Forms(formname).MaxRecords

To set the MaxRecords property, you can use the following:

Forms(formname).MaxRecords = numrecords

where formname is the name of the form expressed as a String, and numrecords is a Long Integer value representing the number of records that will be returned.

Applies to | Form Object