Code to duplicate tables

  • Thread starter Thread starter jnew
  • Start date Start date
J

jnew

Greetings,

Is there a way to programmatically create copies of all
user-created tables in one database into another?

I have created Make-Table queries for each table and run
them as a group using a macro. It works well enough, but
requires me to remember to create a new query and add it
to the macro each time a new table is created. Of course,
there are the similar problems if a table is deleted.

I've tried to write a function that loops through each
TableDef in the CurrentDB's TableDefs collection, catch
each TableDef.Name that is not like "MSys*", and run SQL
to create the duplicate table. It's not working. Any
direction will be greatly appreciated.

jn
 
I've used the docmd.transfer method. Basically I have a button on a form
that does the following:

1. Creates a blank access database
2. Loops through the table collection executing the transfer table method

Hope it helps.
 
Back
Top