无法通过ADODB在Access数据库中打开连接

时间:2018-09-07 07:15:55

标签: vba vbscript adodb

我得到了以下代码,可以在Excel VBA中工作。

Dim con, com

Const adCmdStoredProc = 4
Const scon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Accessdbpath.accdb;Persist Security Info=False;"

Set con = CreateObject("adodb.connection")
Set com = CreateObject("adodb.command")

con.Open scon
Set com.activeconnection = con
com.CommandType = adCmdStoredProc
com.CommandText = "accessqueryname"
com.Execute
Set com.activeconnection = Nothing
Set con = Nothing

我试图在服务器(没有ms office)中运行相同的例程。
因此,我尝试创建一个 VBS 文件来执行此操作,而不是通过Excel VBA。
但是我似乎无法使其工作。我遇到以下错误:

enter image description here

编辑1: 我确实使用流程浏览器检查了我是否以64/32位运行脚本并且以64位运行。

enter image description here

0 个答案:

没有答案