Accessing a Child Rowset

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, applications should use XML.

ADO Technique

When two Recordsets are related, an index is created on the related fields in the child Recordset and a field is added to the Fields collection of the parent Recordset, which has a reference to the child Recordset in the Value property.

To access the child Recordset, you can make a reference to the child Recordset in an empty Recordset object, in effect loading the child Recordset into another. ADO exposes the child field as type adChapter. You can write generic code to handle fields that appear as child Recordsets without having to know the field name ahead of time, as shown in this example:

Dim rChapter As ADODB.Recordset
rst.Open
   "SHAPE {select * from customer}
      APPEND ( {select * from " & _
               "custOrder} AS chapter RELATE cust_id TO cust_id)", cnn
rChapter = rst("chapter")
debug.print rChapter.fields(0)

OLE DB Technique

For more information about accessing a child rowset, see "Navigating Hierarchical Rowsets" in Hierarchical Rowsets.

See Also

Reference

Commands (OLE DB)

Chapter Columns

Chapters

Chapters and Detail Groupings

Hierarchical Rowsets

Lifetime of Row Handles Within Chapters

Releasing Rowsets