2

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.

BIBD
  • 15,107
  • 25
  • 85
  • 137
  • Cross-reference: http://stackoverflow.com/questions/187506/how-do-you-use-version-control-with-access-development http://stackoverflow.com/questions/698839/how-to-extract-the-schema-of-an-access-mdb-database/9910716#9910716 –  Mar 28 '12 at 21:52

2 Answers2

4

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
  • 95,961
  • 11
  • 77
  • 135
  • 2
    And you can use the Application.ImportXML to bring it back in. Application.ImportXML _ DataSource:="tblFooSchema.xml", _ ImportOptions:=acStructureOnly – KevenDenen Jun 01 '10 at 13:37
0

If you need to export DAO specific properties, like title, validation text, etc, you can use AccessSVN. The export format is much like the SaveAsText function for forms or queries. And also, you can import back the schema.

mnieto
  • 3,744
  • 4
  • 21
  • 37