Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing child records in hierarchical recordsets

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a recordset hierarchy, created in Data Environment Designer, that looks like this:

rsGetHeaderRecs
GetLineItems - 1 to n records per Header record
GetCharges - 1 to n number of records per Header

I need to write some of the data out to a text file (as opposed to bind to a control or display on a form). How do I go about stepping through the records and fields returned by the child commands? Just to make things interesting, both Line Items and Charges contain a field with the same name ("DESCRIPTION").

Will something like this (example adapted from MSDN Lib CD) work for multiple child records? Or do I even need to set up separate recordset objects for them?

rsGetHeaderRecs.StayInSync = TRUE
rsGetHeaderRecs.Open "SHAPE etc....
"APPEND etc....
"RELATE etc....

While Not rsGetHeaderRecs.EOF

'Do stuff with current Header Record

Set rsGetLineItems = _
rsGetHeaderRecs("rsGetLineItems").Value

While Not rsGetLineItems.EOF

'Do stuff with current Line Item Record

rsGetLineItems.MoveNext
Wend
rsGetHeaderRecs.MoveNext
Wend

Thanks in advance..


Lee
lee.meinhardt@smna.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top