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

How can I copy a linked table to another table, not just the link?

Status
Not open for further replies.

boysrus

Programmer
Jul 9, 2001
12
0
0
US
My data is in a back-end database. I have a front-end database with all the code, forms, reports, etc. which is "linked" to the back-end. I have written code using the CreateDatabase command to create a new history database called "mmyyy". I would like to write code to copy 3 tables from my back-end datbase to the "mmyy" database.

Wen I try to "export" the tables from the back-end database to the new database, it only exports the "links" and not the actual data. I tried to run three "make-table" queries and that worked OK, but I do not have the "relationships". What is the best way to do this?

 
In addition to collection objects of tables, queries, forms, etc., a database has a collection made up of relation objects.

You would need to programmatically create new relation object in the new database. You can do this using the db.CreateRelation method.

I assume the process would go like this:

--- Cycle through the collection of relation objects in the original database.

---- For each relation object, create a new relation in the new database, and set its properties (i.e., Name, Table, ForeignTable, Attributes) to be identical to those of the key in the old database.

I've never done this, but it should be relatively straightforward. I assume you'll need to study up on the documentation for the relations collection. -- Herb
 
try using a MakeTable Query, and save it into the other MDB.

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top