how to export Access 2010 data macros

unrazzle picture unrazzle · Feb 9, 2012 · Viewed 8.3k times · Source

I need to transfer Access data macros from my test db to my production db. Anybody know how to do that?

I know that transferring tables from one accdb to another will also transfer the data macros, but that's not an option in my case. I also know I can recreate them manually in the production accdb, but that leaves me open to errors and requires taking the production database down for a longer time than would a scripted transfer scenario.

If I only had to do this once it wouldn't be such a big deal, but I'll need to do it many times over the course of a development project.

I've tried exporting the tables to xml, but the data macros are not included.

Please note that I'm asking about Access 2010 data macros here, not regular Access macros.

Answer

Lanik picture Lanik · Oct 27, 2012

You may want to try a pair of undocumented VBA functions

To export:

SaveAsText acTableDataMacro, "TableName", "C:\PathToFile\DataMacro.xml"

To import:

LoadFromText acTableDataMacro, "TableName", "C:\PathToFile\DataMacro.xml"