Copy Table Structure

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
 
R

rkc

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.
 
V

Van T. Dinh

Use the TransferDatabase Method which has
the "StructureOnly" argument.

HTH
Van T. Dinh
MVP (Access)
 
J

jfp

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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top