I went googling and found a code sample that demonstrates how to create an in-memory ADO hierarchical recordset.
Dim rs As New ADODB.Recordset
Dim rsCh As ADODB.Recordset
Dim rsGrndCh As ADODB.Recordset
rs.ActiveConnection = "provider=msdatashape;data provider=none;"
rs.Open " SHAPE APPEND new adInteger As PID, " & _
" New adVarChar(10) As StudentName, " & _
"((SHAPE APPEND new adInteger As ChID, " & _
" New adVarChar(10) As Course, " & _
"((SHAPE APPEND new adInteger As GrndChID, " & _
" New adBSTR As Description) RELATE " & _
" ChID TO GrndChID) As GrandChild) RELATE PID TO ChID) " & _
"AS Child" , , adOpenStatic, adLockOptimistic
' Add a sample record in the parent recordset
rs.AddNew Array("PID", "StudentName"), Array(1, "Jim Smith")
' Now add a two sample child records related to the original
' parent's record
Set rsCh = rs("Child").Value
For i = 0 To 1
rsCh.AddNew Array("ChID", "Course"), Array(1, "Course #1" & i)
' Now add two sample Grand-child records for each child record
Set rsGrndCh = rsCh("GrandChild").Value
For j = 1 To 2
rsGrndCh.AddNew Array("GrndChID", "Description"), _
Array(i, "Description" & Str(j))
Next
Next
Set MSH1.DataSource = rs
MsgBox "Successfully Done..."
rs.Close
rsCh.Close
rsGrndCh.Close
Greg
|