Access VBA:Shell命令在一个特定的数据库中损坏 [英] Access VBA: Shell command broken in one particular database
问题描述
我在同一台计算机上打开了两个Access数据库.在其中之一中,在即时窗口中运行此程序可以按预期工作(打开记事本):
I have two Access databases that I'm opening on the same computer. In one, running this in the immediate window works as expected (opens Notepad):
Shell "notepad.exe"
在另一种情况下,我收到此错误:
In the other, I get this error instead:
运行时错误'5':无效的过程调用或参数
Run-time error '5': Invalid procedure call or argument
我无法提出任何将在第二个数据库中成功运行的shell命令.无论如何,我都会收到该错误.
I have not been able to come up with any shell command that will run successfully in that second database. No matter what, I get that error.
这是怎么回事?安全设置会起作用吗?还是一个较旧的版本?
What is going on here? Could there be a security setting coming into play? Or perhaps one is an older version?
-
当我在故障数据库中转到
Shell
的定义时,它会转到VBA.Interaction.Shell
.
When I go to the definition of
Shell
in the malfunctioning database, it goes toVBA.Interaction.Shell
.
我为Shell
获得了正确的IntelliSense工具提示.
I get the correct IntelliSense tooltip for Shell
.
我尝试了VBA.Shell "notepad.exe"
和VBA.Interaction.Shell "notepad.exe"
都没有成功(相同的错误).
I tried VBA.Shell "notepad.exe"
and VBA.Interaction.Shell "notepad.exe"
without success (same error).
这是在两个数据库中都检查过的引用:
Here are the references that are checked in both databases:
反编译没有帮助.
推荐答案
罪魁祸首是我们的防病毒软件! UGH!
The culprit was our anti-virus software! UGH!
为什么它不能在一个数据库中工作,而在另一个数据库中工作呢?有人告诉我,几年前,我的计算机对一个数据库进行了防病毒例外,而对另一个数据库则没有.
Why did it work in one database and not the other then? I'm told that years ago, anti-virus exceptions were made for my computer for the one database but not the other.
我建议遇到此问题的任何其他人检查其防病毒日志/策略.同样,从具有不同策略的另一台计算机上运行数据库可能会更快地阐明该问题.在这种情况下,当我使用远程桌面登录服务器时,便能够成功调用Shell.
I recommend that any others who encounter this problem check their anti-virus logs/policies. Also, running the database from another computer with different policies in place might shed some light on the issue faster. In this case, when I used remote desktop to log into a server, I was able to call shell successfully.
这篇关于Access VBA:Shell命令在一个特定的数据库中损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!