tags:

views:

49

answers:

1

How can I export/import MS Access table definitions as text files (in a human readable format like I can with Forms or Reports)?

I know how I can export the whole table out into CSV file; however:

  • I don't need the data to go (actually really rather that it didn't)
  • When I import a CSV file (especially without data) there's no guarantee that the data types will be the same as my original database.

I'm hoping to store my table definitions in a SVN repository. I don't want to have to house any import specifications in the destination database.

+3  A: 

Look at the ExportXML method. I have used it to export both table data and structure. However, based on a quick test, it appears you can drop the DataTarget option, and just export SchemaTarget.

Application.ExportXML _
    ObjectType:=acExportTable, _
    DataSource:="tblFoo", _
    DataTarget:="tblFoo.xml"
    SchemaTarget:="tblFooSchema.xsd"
HansUp
And you can use the Application.ImportXML to bring it back in.Application.ImportXML _ DataSource:="tblFooSchema.xml", _ ImportOptions:=acStructureOnly
KevenDenen