Article ID: 185425 - Last Review: March 14, 2005 - Revision: 2.1 INFO: ADO Hierarchical Recordsets via SHAPE APPEND via C++/VBA/JavaThis article was previously published under Q185425 On This PageSUMMARY
This article describes how to use the SHAPE APPEND syntax to produce
hierarchical recordsets and how to traverse them. Sample code is provided
for VBA.
MORE INFORMATION
Hierarchical recordsets present an alternative to using JOIN syntax when
accessing parent-child data. Hierarchical recordsets differ from a JOIN in
that with a JOIN, both the parent table fields and child table fields are
represented in the same recordset. With a hierarchical recordset, the
recordset contains only fields from the parent table. In addition, the
recordset contains an extra field that represents the related child data,
which you can assign to a second recordset variable and traverse.
Hierarchical recordsets are made available via the MSDataShape provider, which is implemented by the client cursor engine. A new clause, SHAPE, is provided to relate SELECT statements in a hierarchical fashion. The syntax is summarized below:
SHAPE {parent-command} [[AS] name]
APPEND ({child-command} [[AS] name] RELATE parent-field TO child-field)
[,({child2-command} ...)]
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. VBA ExampleThis step-by-step example is written for Visual Basic, but could be used in Microsoft Access just as easily.
REFERENCES
ADO Help; search on: "Shape Append Command" For additional information on SHAPE syntax, click the article number below to view the article in the Microsoft Knowledge Base: 189657
(http://support.microsoft.com/kb/189657/EN-US/
)
HOWTO: Use the ADO SHAPE Command
APPLIES TO
| Article Translations
|

Back to the top
