[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

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
0
MFalcon
Asked:
MFalcon
  • 3
  • 2
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
MFalconAuthor Commented:
I agree, so I will save you the trouble.  Thanks for your comments.
0
 
psk1Commented:
Appreciated.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now