Copy Table Structure

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

How can I programatically copy the structure of a table in an existing database
to a new database? The table will be used as a template.

Thanks.

Tom
 
Tom said:
How can I programatically copy the structure of a table in an existing database
to a new database? The table will be used as a template.

There's the CopyObject method, but I don't see a switch for structure only.

If you like to write code it can certainly be done using DAO.
 
Use the TransferDatabase Method which has
the "StructureOnly" argument.

HTH
Van T. Dinh
MVP (Access)
 
Tom said:
How can I programatically copy the structure of a table in an existing database
to a new database? The table will be used as a template.

Thanks.

Tom
The answers given sound good, but ...
When you (via the UI) copy a table (click on table name; Ctl-C; Ctl-V)
you get not only the structure but also any customized view settings
(such as column widths in table view). You might want this to happen in
your situation. In that case, you could copy the entire table (someone
suggested CopyObject) and then delete all records from the copy. Better
yet, do that manually once and save it as the template you later use.
This should work ... comments anyone ?
 
Back
Top