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!

Copy Records with Childrecords in VB 1

Status
Not open for further replies.

bartus991

Instructor
Feb 11, 2009
44
NL
Is ist possible to copy a records with their childrecords in VB. I use the following record Structure

Table 1: Ticketset
Table 2: Ticketset_Pricetypes
Table 3: Ticketset_DayRange
Table 4: Ticketset_TimeRange
Table 5: Ticketset_Rank

Each record will contain multiple child records.

I have creating a form which contains a listbox. With this listbox you can add a new Ticketset based on the selected TicketsetId in the listbox. So the structure/data from table 2 till 5 will be copiied in to the new ticketset.
 
The short answer is "yes".

A slightly longer answer:
Create an Append query for each table with a criteria based on the key field of the records to be copied.

Create a function and run all of the queries from within a single transaction so that they append or fail together. You don't want a situation arising where something crashes in mid-copy leaving you with an incomplete process.

Requery the listbox to pick up the new records.

Cheers,
Bill

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top