Applecore Pages on Microsoft Access

How to programmatically copy a table structure in Access

If you wish to make a copy of the structure only of a table in Access, excluding any data, then you can use the TransferDatabase method to transfer the table into the current database:

Sub sCopyTableStructure(strOldTableName As String, strNewTableName As String)
    If vbYes = MsgBox("Sure?", vbYesNo + vbDefaultButton2 + vbExclamation, " ") Then
        DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, acTable, strOldTableName, strNewTableName, True
    End If
End Sub

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 14:01:40