How do I create an Access 2003 MDE programmatically or by command line in Access 2007?

元气小坏坏 提交于 2019-12-11 09:09:36

问题


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.


回答1:


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).




回答2:


This probably isn't exactly the answer you're looking for, but why not keep Access 2003 + Developer Extensions installed side by side with Access 2007 and just use 2003 to script the mde process?




回答3:


This is also not what you are looking for, but why not use AutoHotKey to do the manual steps you mentioned but through a HotKey?

(I know it sounds like a hack, but it should work well nonetheless.)



来源:https://stackoverflow.com/questions/1495076/how-do-i-create-an-access-2003-mde-programmatically-or-by-command-line-in-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!