Copying Tables

jbb
08-22-2000, 12:27 PM
I have an Access database with three different tables in it. Is there a way that can quickly copy a table from another database into my current database. What I want to do is make my table updateable by copying the new table into the old table's place, but I want to do it in code.

Thanks in advance.

Valkyrie
08-24-2000, 02:51 PM
You can do this from code using SQL statements. The first one clears table1 and the second copies the data from table1_old to table1.

"DELETE * from Table1;"
"INSERT INTO Table1 ( field1, field2, field3)
SELECT Table1_Old.field1, Table1_Old.field2, Table1_Old.field3, *
FROM Table1_Old;"

Cheers


Quote of the moment....
"When you cease to make a contribution you begin to die"

jbb
08-24-2000, 05:52 PM
Is this still possible when my tables have relationships?

Valkyrie
08-28-2000, 09:16 AM
Of course. The only item to look out for is if you have cascade deletes turn on. Then, deleting all rows from the table would cause records in other tables to be deleted as well.

It is unclear to me why you would want to update your table in that manner, as opposed to simply updating the table directly, which is the safest way, but that is for you to decide.

Cheers.

Quote of the moment....
"When you cease to make a contribution you begin to die"

jbb
08-30-2000, 03:17 PM
I apologize for the delay. It's possible to go and update these tables directly. However, there's nine different computers that this database resides on and there will be changes made constantly. If I had some way of making a short program that would take my new table and replace the old table it would save me time in the long run.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum