473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Difficult copy recordset

I need to create a copy of a record and *all* it's related data, from
*all* it's related tables. The only exception is one of it's primary
keys will be incremented.

This app is an onging project for me, so I really dread manually
quering every field in every table, because of all my upcoming
changes, and because there are abbout 12 tables. I just want to be
able to say "copy all related data and increment the key".

Any ideas would be greatly appriciated.
Nov 13 '05 #1
3 1954
I'm afraid there is no simple technique for doing this.

I think the simplest way you to write your code would be to create an object
model based on your data model, and provide load and save operations for the
master entity object that recursively execute load or save calls to the
contained objects.

Using this model, you can execute a load to read the data, increment the key
value in the master object instance, then execute a save to write the new copy
back to the database tables.

The code probably won't seem too hairy of you do it with this approach.

On 27 Nov 2004 22:20:38 -0800, Ju********@gmail.com (JumpinJeff) wrote:
I need to create a copy of a record and *all* it's related data, from
*all* it's related tables. The only exception is one of it's primary
keys will be incremented.

This app is an onging project for me, so I really dread manually
quering every field in every table, because of all my upcoming
changes, and because there are abbout 12 tables. I just want to be
able to say "copy all related data and increment the key".

Any ideas would be greatly appriciated.


Nov 13 '05 #2
Well, that's what I suspected I would hear. There are probably very
few reasons for this in rational db design. It's just a frill I want
to add to the app because the old and new records will be almost
identical. It would save a ton of data entry time.

I'm basically a self-taught Access guy, but I haven't delved into the
world of object model yet. I'm going to read up on it now. Do you know
of any info or examples out there?

Thanks for the help.
Steve Jorgensen <no****@nospam.nospam> wrote in message news:<te********************************@4ax.com>. ..
I'm afraid there is no simple technique for doing this.

I think the simplest way you to write your code would be to create an object
model based on your data model, and provide load and save operations for the
master entity object that recursively execute load or save calls to the
contained objects.

Using this model, you can execute a load to read the data, increment the key
value in the master object instance, then execute a save to write the new copy
back to the database tables.

The code probably won't seem too hairy of you do it with this approach.

On 27 Nov 2004 22:20:38 -0800, Ju********@gmail.com (JumpinJeff) wrote:
I need to create a copy of a record and *all* it's related data, from
*all* it's related tables. The only exception is one of it's primary
keys will be incremented.

This app is an onging project for me, so I really dread manually
quering every field in every table, because of all my upcoming
changes, and because there are abbout 12 tables. I just want to be
able to say "copy all related data and increment the key".

Any ideas would be greatly appriciated.

Nov 13 '05 #3
Actually there isn't much really good info about Object Oriented programming
in Classic VB, so I recommend skimming a general introductory book about
Object Oriented programming, then seeing what of it applies to Access. You
can ignore all the inheritance and polymorphism stuff as relates to this
particular task.

On 28 Nov 2004 10:37:50 -0800, Ju********@gmail.com (JumpinJeff) wrote:
Well, that's what I suspected I would hear. There are probably very
few reasons for this in rational db design. It's just a frill I want
to add to the app because the old and new records will be almost
identical. It would save a ton of data entry time.

I'm basically a self-taught Access guy, but I haven't delved into the
world of object model yet. I'm going to read up on it now. Do you know
of any info or examples out there?

Thanks for the help.
Steve Jorgensen <no****@nospam.nospam> wrote in message news:<te********************************@4ax.com>. ..
I'm afraid there is no simple technique for doing this.

I think the simplest way you to write your code would be to create an object
model based on your data model, and provide load and save operations for the
master entity object that recursively execute load or save calls to the
contained objects.

Using this model, you can execute a load to read the data, increment the key
value in the master object instance, then execute a save to write the new copy
back to the database tables.

The code probably won't seem too hairy of you do it with this approach.

On 27 Nov 2004 22:20:38 -0800, Ju********@gmail.com (JumpinJeff) wrote:
>I need to create a copy of a record and *all* it's related data, from
>*all* it's related tables. The only exception is one of it's primary
>keys will be incremented.
>
>This app is an onging project for me, so I really dread manually
>quering every field in every table, because of all my upcoming
>changes, and because there are abbout 12 tables. I just want to be
>able to say "copy all related data and increment the key".
>
>Any ideas would be greatly appriciated.


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tlm | last post by:
Hello All, I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also has a subform embedded in it (SubFrmC) The form's recordsource is based on a table (TblA). SubFrmB's...
6
by: Geir Baardsen | last post by:
Hi! This is a routine for copying a recordset into a new order. It has worked fine under Win98. However, my client has changed to Win XP, and suddenly it doesn't work anymore. I keep getting the...
1
by: Geir Baardsen | last post by:
Hi! As you can see I have worked with my code and done some changes. Now the code will execute, because of this, and because I took away some code in the OnCurrent event that was probably causing...
3
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
7
by: Eric | last post by:
I want to open up 2 record sets. Then, copy everything from one record set to another (excluding a few fields). Is this possible? I need to exclude my primary key, and fields starting with...
4
by: Jim Devenish | last post by:
I wish to copy a table on a SQL Server backend to a table on an Access (.mdb) front end in the simplest way. I have the following to get the recordset but am seeking something easier. Dim...
2
by: mustang123 | last post by:
Hi, I get data from sybase server using ADO Connection and disconnected recordset in my access Database. Now I have a disconnected recordset. I want to insert the contents of this recordset...
3
by: Richnep | last post by:
Hi all, I have tabbed subforms where I need to copy one field value from one subform over to another subform. Although I can run an update query to accomplish this I would like to do it through...
0
by: Neelesh2007 | last post by:
Hi all, I have project with VB6.0 and Access-2003. I have datagrid and ADODC as datasource to retrieve records from database. To export the data of datagrid to Excel I am using Copy From Recordset...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.