子窗体上控件的错误处理事件

发布于 2024-10-01 15:40:58 字数 574 浏览 0 评论 0原文

因此,我在 Access 2007 中构建了一个表单,并在其上放置了一个子表单。然后,我转到子窗体上的其中一个控件的属性表,并使用构建器指向 OnClick 事件的代码构建器。这将打开 VBA 编辑器和插入了一个子骨架。我在这里添加了代码(到目前为止只是一个奇怪的 MsgBox),保存并保存;尝试运行(打开)表单。它看起来不错,但是单击具有事件代码的控件会立即产生以下结果:

作为事件属性设置输入的单击表达式产生以下错误:Microsoft Access 作为与ActiveX Control的OLE服务器通信。

所谓的错误通知帮助完全没用。它显示:

当事件因 Microsoft Office Access 无法评估事件逻辑的位置而无法运行时,就会发生此错误。例如,如果窗体的 OnOpen 属性设置为 =[Field],则会出现此错误,因为 Access 期望在触发事件时运行宏或事件名称。

Access 知道设计时发生了什么,因为它让我进入了 VBA。属性表条目确实显示为“[事件过程]”。是否有一个秘密的忍者技巧来处理子表单中的事件,或者它根本不可能?

So, I built a form in Access 2007, and put a subform on it. Then I went to the Property Sheet for one of the controls on the subform and used the builder to point to Code Builder for the OnClick event. This opened the VBA editor & inserted a sub skeleton. I added code here (just a freakin' MsgBox, so far), saved & tried running (opening) the form. It looks good, but clicking the control that has event code yields this, immediately:

The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access as communicating with the OLE server of ActiveX Control.

The so-called Help on the error notification is completely useless. It reads:

This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired.

Access knew what was going on at design time, since it dropped me into VBA. The Property Sheet entry does read "[Event Procedure]". Is there a secret ninja trick to handling events from a subform, or is it just not possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

段念尘 2024-10-08 15:40:59

我删除了问题子表单 &创建了一个新的。这似乎按预期工作。去算算吧....

I deleted the problem subform & created a new one. This one seems to work as expected. Go figure....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文