Copying structure of table only.

Another solution to copying structure only:
The solution provided by qpbuenrostro is very useful and easy.  It does not however copy any properties or indexes.
The following solution copies the structure only:
Use a macro.
Use Action:    TransferDatabase
Transfer type: Import
Database type: Microsoft Access
Database name: c:\my documents\my db.mdb
Object Type:   Table
Source:        MyTable
Destination:   MyNewTable
Structure Only:Yes
LVL 1
MFalconAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TrygveCommented:
And for those of us who "hate" macros, here is a general version that can be used from code.

Sub CopyTable(pSourceName, pTargetName, Optional pStructureOnly As Boolean)

    DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentDb.Name, acTable, pSourceName, pTargetName, pStructureOnly

End Sub


To copy a table (The table Cities used as example):
CopyStructureOfTable "Cities","Cities Copy"
or
CopyStructureOfTable "Cities","Cities Copy", False

To copy only the structure:
CopyStructureOfTable "Cities","Cities Copy", True


The sub can/should be enhanced to consider whether the TargetName already exist in the database...
0
MFalconAuthor Commented:
This question has a deletion request Pending
0
TrygveCommented:
This question no longer is pending deletion
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

TrygveCommented:
Should I post an "Answer" that would make this question live in the PAQ area so other visitors can benefit from the information?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MFalconAuthor Commented:
I agree, so I will save you the trouble.  Thanks for your comments.
0
psk1Commented:
Appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.