Can there be some code available that allows me serialize all of the objects within an MS Access MDB File.
All of the Objects like Table definitions, Table Data, Query defintions, Report definitions, VB Modules ought to be written to 1 or multiple text files.
There is no need to turn back operation (but could be nice to possess). I wish to place the text files to some VCS in order to track changes and document.
- To import/export Access forms, modules or macros from/to text files, make use of the undocumented LoadFromText/SaveAsText techniques of the applying object. (it appears you should use exactly the same techniques with query and report objects)
- For tables, you should use the transferDatabase approach to the DoCmd object. Be cautious. In so doing you'll loose the table structures and evaluating text files content can be really hazardous. I'd counsel you to build up your personal tool for table structure comparison. I suppose some programs can also be found around the internet (google for MS Access table comparison)
- To check different versions of the identical forms/modules/macros as text files, make use of a softare for example Files Compare Tool
You'll have to write some 'cleaning' code when conveying using the SaveAsText commande, to be able to ease file comparison by (for instance) controlling line amounts or internal access references.
Book even the following links:
Unsure what David Fenton's comment describes since there's many different ways to complete SaveAsText. Should you choose it the following, it ought to be helpful.
For Each obj In Access.Application.CurrentData.AllQueries Access.Application.SaveAsText acQuery, obj.Name, strFilePath & "\Query_" & obj.Name & ".txt" Next
So far as table definitions go, you may decide to check out the XML Export feature the following:
For Each obj In Access.Application.CurrentData.AllTables Access.Application.ExportXML acExportTable, obj.Name, _ strFilePath & "\TData_" & obj.Name & ".xml", _ strFilePath & "\TDef_" & obj.Name & ".xsd", , , acUTF8 Next