Can anyone please help me with re-querying a reshaped recordset.

I'm working on a DataSource class that takes a non-parameterized hierarchical
recordset and splits out the chapters into a collection of child recordsets.
It also using reshaping to create a non-chaptered recordset for each child
(code "SeparateChildren" below). These recordsets are then offered as DataMembers
to bound Data Consumers.

Requerying the root and child chaptered recordsets is straightforward enough.
What I can't get right is how to deal with the chapterless recordsets when
requerying the root recordset. If I just try to Requery them as well, I get
the error -2147217900 "Rowset to be reshaped cannot be uniquely identified.
Multiple rowsets have the name [alias]". MSDataShape is presumably not flushing
the previous version of the named rowsets when the root is requeried.

If I just ignore them and only requery the root recordset, changes to the
chaptered versions are no longer reflected in the chapterless ones. If I
set the dynamic Connection property "Unique Reshape Names" to True and Requery
the chapterless recordsets there is no error, but again they lose sync with
their chapterless equivalents - presumably because entirely new rowsets have
been created.

Destroying all the recordsets and starting again in order to requery does
not work when a Data Consumer is attached (same error). Closing and re-opening
the connection DOES work, but I'd prefer to avoid this if possible. Is it
the only way?

I'm using VB6.0, ADO2.6, MSDataShape Provider. I'm aware of bug Q288409 but
I'm not sure it's relevant..

Any thoughts most welcome.

Jonathan Gibbs

Private Sub SeparateChildren(ParentRst As Recordset)
Dim fld As Field
Dim ChildRst As Recordset
With ParentRst
For Each fld In .Fields
If fld.Type = adChapter Then
'add the Chapterless version to the recordsets collection
Set ChildRst = New Recordset
ChildRst.Open "SHAPE " & fld.Name, MyConnection, adOpenStatic,
adLockOptimistic, adCmdText
'prefix key with _ for later identification as Datamember
colRecordsets.Add ChildRst, "_" & fld.Name
DataMembers.Add "_" & fld.Name
'now the Chaptered version
Set ChildRst = fld.Value
colRecordsets.Add ChildRst, fld.Name
DataMembers.Add fld.Name
'recurse on the chaptered recordset
SeparateChildren ChildRst
End If
Next
End With
End Sub

Private Sub RequeryChildren(ParentRst As Recordset)
Dim fld As Field
Dim ChildRst As Recordset
With ParentRst
For Each fld In .Fields
If fld.Type = adChapter Then
'requery the Chapterless version
Set ChildRst = colRecordsets("_" & fld.Name)
ChildRst.Requery 'ERROR GENERATED HERE
DataMemberChanged "_" & fld.Name
'remake the chaptered recordset
set colRecordsets(fld.Name) = fld.Value
DataMemberChanged fld.Name
'recurse with the chaptered recordset
RequeryChildren fld.Value
End If
Next
End With
End Sub