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

In code in Access, copy and paste an entire table 1

Status
Not open for further replies.

CaneMan

IS-IT--Management
Feb 19, 2004
9
US
I have an mde that uses an associated mdb for external
tables that are replicated. Since they are replicated, I
cannot make any changes to the structure of the table. I no
longer need the replication, but since this is a
distributed product with client specific records in the
external tables, I cannot make changes here and
redistribute the database without losing all the data the
clients have in their database without some kind of copy
routine. The simplest solution would be, from my mde, copy
the replicated table, paste it back with a different name,
rename the old table, rename the new table to the old name,
and then delete the old table. Is there a way that anyone
knows of that I can do in code to effect this.
 
Probably you can do somethinbg like this:


Dim str_SQL As String

DoCmd.SetWarnings False
str_SQL = "select * into tbl_new from tbl_old;"
DoCmd.RunSQL (str_SQL)
str_SQL = "Drop table tbl_old;"
DoCmd.RunSQL (str_SQL)
DoCmd.Rename "tbl_tmp_old", acTable, "tbl_new"
DoCmd.SetWarnings True


Alexandre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top