Cosmos75
Registered User.
- Local time
- Today, 04:50
- Joined
- Apr 22, 2002
- Messages
- 1,281
What I'm trying to accomplish is to append data from another file into a file with the same table structure. There are some problems that I can see at the moment:
Putting aside the first problem for now, is there a way to deal with the second issue?
I can iterate through the DAO tabledefs collection and use db.Execute to run an append action query, but that just goes through the tables in alphabetical order which isn't helpful, because data from a many-side table (child) could be attempted to have data appended which would fail since the one-side table (parent) hasn't had data appended to it.
The only solution I can think of involves manually setting the order the tables in code, e.g.
I was wanting to see if there is a way to avoid having to do that.
Thanks!
- Autonumber fields as primary keys/unique indexes could cause problems with duplicates
- Data must be appended on 'one-side' (parent) tables first for the 'many-side' (child) tables
Putting aside the first problem for now, is there a way to deal with the second issue?
I can iterate through the DAO tabledefs collection and use db.Execute to run an append action query, but that just goes through the tables in alphabetical order which isn't helpful, because data from a many-side table (child) could be attempted to have data appended which would fail since the one-side table (parent) hasn't had data appended to it.
The only solution I can think of involves manually setting the order the tables in code, e.g.
Code:
db.Execute "INSERT INTO [tblParent1] SELECT [tblParent1].* FROM [tblParent1] IN 'C:\Folder\'"
db.Execute "INSERT INTO [tblParent2] SELECT [tblParent2].* FROM [tblParent2] IN 'C:\Folder\'"
db.Execute "INSERT INTO [tblChild1] SELECT [tblChild1].* FROM [tblChild1] IN 'C:\Folder\'"
db.Execute "INSERT INTO [tblChild2] SELECT [tblChild2].* FROM [tblChild2] IN 'C:\Folder\'"
I was wanting to see if there is a way to avoid having to do that.
Thanks!