Cannot edit or re-save an existing event-driven Data Macro in Access 2010

耗尽温柔 提交于 2019-11-26 23:41:59

问题


(This is a follow-up to an answer from an earlier question here.)

I have an Access 2010 database file containing a table with a Before Change Data Macro:

I can open the table in Datasheet View and add rows, and the Data Macro behaves as expected. However, if I open the table in Design View, open the Data Macro for editing, do something trivial like click the [+] beside one of the macro steps to expand the details, and then try to save the "changes" I get the error

The 'LookUpRecord' macro action has an invalid value for the 'Look Up A Record In' argument.

I have also tried to create the macro from scratch in a fresh Access 2010 .accdb and get the same error. I have tested this on three different machines: two machines running 64-bit Access 2010 and one machine running 32-bit Access 2010. All machines are fully patched via Microsoft Update. (That is, they are currently running version 14.0.7106.5003.)

While testing I noted that this appears to be related to an event-driven Data Macro trying to use LookUpRecord to perform a SELECT on the same table to which the Data Macro applies. Performing a SELECT on some other table does not seem to trigger the error.

My questions are:

  1. Can anyone recreate this issue with a patched version of Access 2010?

  2. Can anyone test this with an unpatched version of Access 2010 (e.g., fresh install from an early release) to see if a subsequent patch broke changed something?

  3. Has anyone seen any documentation or Internet chatter to suggest that an event-driven Data Macro for a particular table should (or should not) be able to do a LookUpRecord by performing a SELECT on itself?

Edit -- 2013-12-19 14:10 UTC:

I just tested this with Access 2010 SP1 (14.0.6023.1000) and got the same results.


回答1:


I think the issue is the table alias. If you open the table out in layout mode (just open the table NOT in design mode). You then get this:

You can now edit the macro freely (such as expand an action) and then save the macro.

I suspect this is an un-intended bug since if the table is opened in design mode then the table is locked and the macro cannot get/check verify the SQL used in the lookup command.

Note that if you JUST PLACE the table name in the macro designer then you have NO problem and this is what 99% of people do in this case.

Most most don't know you can free hand type in SQL here!!!

Upon save the designer attempts to verify the SQL against the table – but the table is locked in design mode. So in a round about way, this is a bug, but few encounter it due to few typing in SQL into that lookup record command.

I would as noted just open up the table by clicking on it and not use design mode to make changes. And note in the above screen shot how the event buttons are separate buttons and easier to hit then when opening table in design mode.

Note that in order to edit the Data Macros directly from Datasheet view the database must have the "Enable design changes for tables in Datasheet view" option enabled:

If that option is not set then the Data Macro buttons are disabled in Datasheet view.



来源:https://stackoverflow.com/questions/20661510/cannot-edit-or-re-save-an-existing-event-driven-data-macro-in-access-2010

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