我收到一个类型不匹配的错误 AccessApp.Docmd.RunCommand "RunUpdate"
我正在尝试通过自动化打开一个访问数据库,并在一个模块中运行一个公共潜艇。这就是我正在使用的。
Sub VCSUpdate()
On Error GoTo ErrorHandler
Dim AccessApp As New Access.Application
Set AccessApp = New Access.Application
AccessApp.AutomationSecurity = msoAutomationSecurityLow
AccessApp.OpenCurrentDatabase CurrentProject.Path & "\VICI Desktop Installer.accde"
AccessApp.RunCommand "RunInstall" '<------ errors here
AccessApp.CloseCurrentDatabase
AccessApp.Quit
Exit Sub
ErrorHandler:
Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext
End Sub
这就是.Runcommand
运行的目的
Public Sub RunInstall()
Call LinkFrontEnd
Call InstallDesktopVICI
End Sub
我两个都试过AccessApp.docm.runcommand
,AccessApp.Runcommand
都出现同样的错误。
你误会Application.RunCommand
了Application.Run
。使用Application.Run
调用一个字符串的用户定义函数时。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句