accde数据库中类对象中的VBA代码错误

问题描述:

这是我在这里的第一篇文章,所以我希望我做得对。


将Access 2007 accdb数据库转换为accde后,我的vba代码模块运行正常,但我的类对象(表单)中的代码不会运行。在这些情况下,我总是收到错误消息表达式在Dbl上单击您输入的事件属性设置产生以下错误:由于项目受到保护而无法执行操作 (或类似事件取决于特定事件)。


请注意,运行accdb文件时我没有收到任何错误。


我不明白为什么有些代码有效,有些代码不行。我已经在谷歌搜索了几天找到解决方案,但我找不到这种情况。


我只将前端文件转换为accde,而不是后端表。我在表UsysRibbons中有一个自定义功能区xml脚本,它位于前端(因为如果我将它放在后端,它就不起作用)。


我的文件都在受信任的位置,我在制作accde文件之前立即编译,我检查了我的参考资料,我已经解编和编译,我已经将所有对象复制到一个新的(干净的)数据库,我甚至用mdb和mde尝试过。每次都有同样的问题。


我的引用是:

Visual Basic For Applications

Microsoft Access 12.0对象库

OLE自动化

Microsoft Office 12.0 Access数据库引擎对象

Microsoft Office 12.0对象库

Microsoft脚本运行时


我们非常感谢任何建议。

Hi, this is my first post here, so I hope I''m doing it right.

After converting an Access 2007 accdb database to accde, the vba code in my modules runs OK, but the code in my class objects (forms) wont run. In these cases, I always get the error message "The expression On Dbl Click you entered as the event property setting produced the following error: Can''t perform operation since the project is protected" (or something similar depending on the particular event).

Please note that I don''t get any errors when running the accdb file.

I don''t understand why some of the code works, and some doesn''t. I have searched Google for several days to find a solution, but I can''t find this situation.

I am converting the front end file only to accde, not the back end tables. I do have a custom ribbon xml script in table UsysRibbons, which is located in the front end (because it doesn''t work if I put it in the back end).

My files are all in trusted locations, I compile immediately before making the accde file, I''ve checked my References, I''ve de-compiled and compiled, I''ve copied all objects to a new (clean) database, I''ve even tried it with mdb and mde. Same problem every time.

My references are:
Visual Basic For Applications
Microsoft Access 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Access database engine Object
Microsoft Office 12.0 Object Library
Microsoft Scripting Runtime

Any suggestions would be greatly appreciated.

您需要发布双击时输入的表达式以提供任何帮助。如果你不告诉我们代码是什么,很难告诉你为什么代码不会工作。
You would need to post the expression that you entered on the double click to offer any help. Hard to tell you why the code won''t work if you don''t tell us what the code is.


很抱歉。这是代码。

Sorry about that. Here is the code.

展开 | 选择 | Wrap | / span> 行号


我在该代码中看不到任何可能导致此类错误消息的内容。


也许您可以通过告诉我们错误发生在哪个行号来缩小搜索范围(如果您有任何了解的话)。
I see nothing in that code that might lead to such an error message.

Perhaps you could narrow down the search by telling us which line number the error occurs on (if you have any way of knowing that).