vba MS Access Treeview 加载 ActiveX 控件时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12037965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 17:23:01  来源:igfitidea点击:

MS Access Treeview error loading ActiveX control

vbams-accessactivexaccess-vba

提问by Matthias S

Possible Duplicate:
MS-access doesn't catch treeview events after win sec-update

可能的重复:
在赢得秒更新后,MS-access 不捕获树视图事件

recently an error appeared with a Treeview element in my access form.

最近,我的访问表单中的 Treeview 元素出现错误。

The expression Expand you entered as the event property setting produced the following error: There was an error laoding an ActiveX control on one of your forms or reports.

您作为事件属性设置输入的表达式 Expand 产生了以下错误:在您的窗体或报表之一上加载 ActiveX 控件时出错。

When I click "OK" (only opportunity) the next error appears (Expand is replaced by MouseMove, MouseDown/Up, DblClick etc.), when I press Keys the KeyDown/Up/Press Message appears etc. When I interact with the TreeView then the "Expand" is replaced by e.g. NodeClick or Collapse. Every message only appears once, when I performed every possible Event no message pops up - but the treeview doesnt work, it doesnt open any form (the treeview is used as a menu).

当我单击“确定”(唯一的机会)时,出现下一个错误(扩展被 MouseMove、MouseDown/Up、DblClick 等取代),当我按下 Keys 时,KeyDown/Up/Press 消息出现等。当我与 TreeView 交互时然后“Expand”被替换为例如NodeClick 或Collapse。每条消息只出现一次,当我执行每个可能的事件时,没有消息弹出 - 但树视图不起作用,它不会打开任何表单(树视图用作菜单)。

The mysterious thing to me is - last week those Access Databases all worked fine - we have a database for every customer (frontend and data together) and now suddenly every database 'crashes'. I assumed that the ActiveX Treeview Control was changed by a Windows Update or something similar but also an old WinXP laptop throws the same error messages. Even a database that hasnt been opened for 2 weeks and definitely worked back then doesnt work anymore. So from my point of view there cant be anything in the code that is wrong.

对我来说神秘的是 - 上周那些 Access 数据库都运行良好 - 我们为每个客户(前端和数据一起)都有一个数据库,现在突然每个数据库都“崩溃”了。我认为 ActiveX Treeview 控件已被 Windows 更新或类似的东西更改,但旧的 WinXP 笔记本电脑也会抛出相同的错误消息。即使是一个已经 2 周没有打开并且肯定工作过的数据库也不再工作了。所以从我的角度来看,代码中不能有任何错误。

Nevertheless I tried to set a breakpoint in the Form_Load event, but the Expand Error already pops up before the first line of OnLoad is executed. The OnLoad Event is the only event that is specified (GUI says "Event Procedure", its VBA Code only) and all other fields are blank (and no code specified). I created a blank VBA for e.g. MouseMove, but the error still appears.

尽管如此,我还是尝试在 Form_Load 事件中设置断点,但是在执行 OnLoad 的第一行之前,Expand Error 已经弹出。OnLoad 事件是唯一指定的事件(GUI 显示“事件过程”​​,仅其 VBA 代码),所有其他字段均为空白(且未指定代码)。我为例如 MouseMove 创建了一个空白的 VBA,但错误仍然出现。

What is this error and where does it come from? Hope anyone can help.

这是什么错误,它来自哪里?希望任何人都可以提供帮助。

Regards,

问候,

Matthias

马蒂亚斯

P.S.: My Treeview ProjectVia this Link you find the files for a treeview project in MS Access (mentioned in the first answer). When I download these files the same kinds of error appear.. so it definitly has to do with the activeX controls, right? Is there anybody where these files work, and if so - why? Hope anybody can help..

PS: 我的树视图项目通过此链接,您可以在 MS Access 中找到树视图项目的文件(在第一个答案中提到)。当我下载这些文件时,会出现相同类型的错误......所以它肯定与activeX控件有关,对吗?有没有人在这些文件工作,如果有 - 为什么?希望任何人都可以帮助..

回答by C Roberts

I was having the same problem - treeview worked last week not today in either 2007 or 2010 Access, multiple PCs. Problem was Windows update. (See link http://support.microsoft.com/kb/2687441). I created and ran the batch file as indicated in the kb article and my Treeview now works.

我遇到了同样的问题 - treeview 上周在 2007 或 2010 Access,多台 PC 中工作,而不是今天。问题是 Windows 更新。(请参阅链接http://support.microsoft.com/kb/2687441)。我按照知识库文章中的说明创建并运行了批处理文件,现在我的 Treeview 可以工作了。

回答by Lucas

I got the same error. I found the solution in the following link: http://mymsaccessblog.blogspot.nl/2008/09/my-teeview-project-episode-5-using.html

我得到了同样的错误。我在以下链接中找到了解决方案:http: //mymsaccessblog.blogspot.nl/2008/09/my-teeview-project-episode-5-using.html

I added the following sub listed below and adjusted it with the key I used and it worked. I hope this helps you as well. Sorry if the formatting is not good. First time I post anything

我添加了下面列出的以下子项,并使用我使用的密钥对其进行了调整,并且它起作用了。我希望这也能帮助你。如果格式不好,请见谅。我第一次发帖

Private Sub xProductTreeview_Click()

私有子 xProductTreeview_Click()

Dim nodSelected As MSComctlLib.Node ' a variable for the currently selected node

Dim nodSelected As MSComctlLib.Node ' 当前选定节点的变量

Set nodSelected = Me.xProductTreeview.SelectedItem ' get the currently selected node

If nodSelected.Key Like "Prod=*" Then ' are we on a product node
ElseIf nodSelected.Key Like "Cat=*" Then ' are we on a category node
Else ' somehow this is neither a category or product node
End If

End Sub

结束子