如何导出 Access 2010 数据宏 [英] how to export Access 2010 data macros

查看:26
本文介绍了如何导出 Access 2010 数据宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将 Access 数据宏从我的测试数据库传输到我的生产数据库.有人知道怎么做吗?

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

我知道将表从一个 accdb 转移到另一个也会转移数据宏,但在我的情况下这不是一个选项.我也知道我可以在生产 accdb 中手动重新创建它们,但这让我容易出错,并且需要比脚本传输场景更长的时间关闭生产数据库.

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.

我尝试将表导出到 xml,但不包含数据宏.

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

请注意,我在这里询问的是 Access 2010 数据宏,而不是常规的 Access 宏.

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

推荐答案

我在这里没有很好的答案.

I don't have a great answer here.

但是,过去我经常制作表格更改的日志",然后在现场简单地使用它.

However, in the past I often made a "log book" of changes to tables and then simple used that on site.

请注意,您可以剪切+粘贴宏代码.并且代码保存为 XML.

Do note that you can cut + paste macro code. And the code saves as XML.

例如,更新表触发器在 Access 中如下所示:

For example, this after update table trigger looks like this in Access:

如果你把上面的(ctrl-a,ctrl-cc)剪掉,那么你可以把它粘贴到记事本上.事实上,您甚至可以在 Visual Studio 或任何 xml 编辑器中粘贴/打开它,您会看到:

If you cut out the above (ctrl-a, ctrl-cc),, then you can paste that into a note pad. In fact you can even paste/open it in visual studio or any xml editor, and you see this:

这样你就可以剪切+粘贴这些宏了.

So you can cut + paste out of those macros.

如前所述,因此在过去,我经常保留更改的日志".

As noted, thus in the past I often kept a "log" of changes.

因此,如果我在异地工作并修改了 2 个代码模块、4 个表单和 2 个报告,那么我就有了一些更改日志.我会在此表中输入更改的对象.

So if I was working off site and I modified 2 code modules, 4 forms and 2 reports, then I had a little log of changes. I would type into this sheet what object was changed.

当我到达现场时,我快速浏览了该表,我知道要导入 3-5 个对象,而这样的导入只需几分钟.

When I get on site, then I quick glance at that sheet and I know to import the 3-5 objects and such a import is only a few minutes tops.

但是,使用表触发器和存储过程,您可以复制更多而不是少数.

However, with table triggers and store procedures, you could have more then just a few to copy.

我会做两件事之一:

使用日志的想法和

a) 取消发布开发版本并将其带到您的工作站点.然后导入新的表格、报告等.对于触发代码,您在两个应用程序之间进行剪切 + 粘贴.

a) Un-publish the development version and bring that with me to your working site. You then import new forms, reports etc. For trigger code, you cut + paste between the two applications.

b) 当您对触发器进行更改时,将其剪切并粘贴到记事本文档中并将它们放在一个目录中.在现场时,只需拿起每个记事本,剪切并粘贴到生产环境中,然后将记事本项目移动或复制到完成"文件夹中.

b) When you make a change to a trigger, then cut + paste into a note pad doc and place them in a directory. When on site, simply take each notepad, cut + paste into production and then move or copy the notepad item into a "done" folder.

以上肯定不太理想.再一次,在过去,我并不总是有代码来编写表格更改的脚本,并且使用一个小日志表效果很好.

The above is certainly less than ideal. Then again in the past I not always had code to script out a table change, and using a little log sheet worked quite well.

所以过去我经常只是写下修改了某某表,我必须添加某某列.

So in the past I often just written down that such and such table was modified and I have to add such and such column.

因此,您可以选择将宏代码作为 xml 剪切并粘贴到单独的小文档中,还是直接从开发中剪切并粘贴到生产中.

So it really your choice as to if you want to cut + paste out the macro code as xml into separate little documents, or cut + paste right out of development into production.

我确实认为如果您在不同的位置工作,那么我认为最好取消发布开发版本,并将其随身携带(我假设您知道/意识到您可以制作未发布的网络应用程序).

I do think if you working in differnt location, then I think it likely best to un-publish the development version, and bring that with you (I assume you know/realaize that you can make a un-published copy of a web application).

因此表单、代码模块、宏等可以很容易地导入(您删除表单等,然后从未发布的副本中导入).

So the forms, code modules, macro's etc can just be imported rather easy (you delete the forms etc, and just import from that un-published copy).

但是,对于表代码?您必须一次从未发布的副本中剪切 + 粘贴到某个暂存区域,或者按照说明在应用程序之间进行剪切 + 粘贴.

However, for the table code? You have to cut + paste from that un-published copy one at a time into some staging area, or as noted cut + paste between the applications.

另存为文本可能会在这里起作用,但我还没有时间制定更好的解决方案.

There is the possibility that save-as text might work here, but I not yet had the time to cook up a better solution.

顺便说一句,在上面我假设了一个 Web 服务数据库,但建议仍然适用于非 Web Access 数据库.

By the way, in above I assumed a web services database, but the advice still applies to non web Access databases.

这篇关于如何导出 Access 2010 数据宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆