Ms-access – How to create an Access 2003 MDE programmatically or by command line in Access 2007

ms-accessms-access-2003ms-access-2007

I have a legacy Access 2003 database file that must remain in that format to preserve its menus and toolbars. I have recently moved to Access 2007 in my build environment and will be deploying the compiled Access 2003 program with the Access 2007 runtime. In Access 2003, I could script the process of creating an MDE with the Access Developer Extensions (WZADE.mde) using the command line and an .xml file of build preferences (without creating an install package). The Access 2007 developer extensions do not seem to offer a similar option. I can "Package a Solution", but it creates an accdr and buries it in a CD installer. I've tried programmatic options like Docmd.RunCommand acMakeMDEFILe and Syscmd(603, mdbpath, mdepath) but they no longer work in Access 2007. Of course, i can manually create an MDE using Database Tools>Create MDE, but that is no scriptable as far as I can tell.

Best Answer

Try this:

Dim objAccess As Object
'Create the Access Automation object
Set objAccess = CreateObject("Access.Application")
'Now call the undocumented function...
objAccess.SysCmd 602, cstr(strPathSourceMdb), cstr(strPathDestinationMdb)
Set objAccess = Nothing

Here is a link (with more undocumented features).

Related Topic