ADODB Object
 
Syntax
 
Set recordsetobject = recordsetobject.NextRecordset([RecordsAffected])
 
Description
Clears the current Recordset object and returns the next Recordset object.
 
The NextRecordset method is called when you want to clear the current Recordset and return the next Recordset.
 
The next Recordset object can be returned as:
  • a closed recordset with records,
  • a closed non-row returning recordset containing no records,
  • or an empty recordset with both BOF and EOF equal to True. You should not call this method while the current Recordset is still being edited.
 
You can use this method to advance through a compound command statement or a stored procedure that needs to return multiple results. For example, in a compound command statement, ADO will process the first query and return the resultant Recordset. By calling the NextRecordset method, you can next process the second query (and so on). After all of the results are returned, the Recordset will be set to nothing.
 
There is one optional output parameter.
 
Parameter
Description
RecordsAffected
The optional RecordsAffected parameter is a long value returned by the provider that is the number of records affected by the current operation.
See Also
Command.Execute, BOF, EOF, State, Open.
Example
 
Do While Not objRecordset.State = adStateClosed
   For Each objField In objRecordset.Fields
      Debug.Print objField.OriginalValue
      Debug.Print objField.UnderlyingValue
      Debug.Print objField.Value
   Next
 
   Set objRecordset = objRecordset.NextRecordset
Loop