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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I copy records in Master/Detail TTable relationship ? 1

Status
Not open for further replies.

RonR51

Programmer
Apr 19, 2001
18
AU
I am writing a Delphi 5 app that has about 20 paradox tables accessed through TTable and TQuery components. I have several tables set up in master/detail relationships.

I want to give the user the facility to duplicate a master/detail record set so that they can then create new sets based on existing sets. That is, copy one master record and all of its detail records. I have managed to copy single records not in a M/D setup but I am having difficulty working out a way to keep track of 4 different tables, 2 source tables and 2 destination tables.

Any ideas

RonR51
 
Have you tried TBatchMove? It appears as though the following might copy your detail records.
Use a TQuery as the source and a TTable as the destination for a TBatchMove. The TQuery and the TTable both reference the detail table. The TQuery is linked through its datasource property to the master (where the appropriate record is selected).
You will need to change some fields in the records as they are copied. Set up calculated fields in the TQuery to generate the new values and use them in the mappings property of the TBatchMove to create the changed values in the destination records.
Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top