NextRecordset Method (DAO)

Microsoft DAO 3.60

NextRecordset Method

           

Gets the next set of records, if any, returned by a multi-part select query in an OpenRecordset call, and returns a Boolean value indicating whether one or more additional records are pending (ODBCDirect workspaces only).

Syntax

boolean = recordset.NextRecordset

The NextRecordset method syntax has these parts:

Part Description
boolean A Boolean variable. True indicates the next set of records is available in recordset; False indicates that no more records are pending and recordset is now empty.
recordset An existing Recordset variable to which you want to return pending records.

Remarks

In an ODBCDirect workspace, you can open a Recordset containing more than one select query in the source argument of OpenRecordset, or the SQL property of a select query QueryDef object, as in the following example.

SELECT LastName, FirstName FROM Authors 
WHERE LastName = 'Smith';
SELECT Title, ISBN FROM Titles 
WHERE Pub_ID = 9999

The returned Recordset will open with the results of the first query. To obtain the result sets of records from subsequent queries, use the NextRecordset method.

If more records are available (that is, there was another select query in the OpenRecordset call or in the SQL property), the records returned from the next query will be loaded into the Recordset, and NextRecordset will return True, indicating that the records are available. When no more records are available (that is, results of the last select query have been loaded into the Recordset), then NextRecordset will return False, and the Recordset will be empty.

You can also use the Cancel method to flush the contents of a Recordset. However, Cancel also flushes any additional records not yet loaded.