从Excel控制访问:远程服务器计算机不存在或不可用

时间:2017-08-03 17:47:14

标签: excel-vba ms-access access-vba vba excel

我正在运行一个简单的脚本,如下所述。

Sub New_Liabilities()

MsgBox ("It may take a while for the query to complete; be patient.  Please wait for the 'Done' message to confirm that the task is complete.")

    Dim strDatabasePath As String
    Dim PathToDB As String
    Dim accApp As Access.Application
    Set accApp = New Access.Application

    PathOfDatabase = ThisWorkbook.Worksheets("Manual_Updates").Range("PathToAccess")
    accApp.OpenCurrentDatabase PathOfDatabase
    accApp.DoCmd.SetWarnings False
    accApp.DoCmd.RunMacro "Macro_Prep_Liabilities"
    accApp.DoCmd.SetWarnings True
    accApp.Quit
    Set accApp = Nothing

ActiveWorkbook.RefreshAll

MsgBox "Done!  All processes complete!!"

End Sub

我不断收到一条错误消息: 'remote server machine does not exist or is unavailable'

问题出现在这一行:

accApp.DoCmd.RunMacro "Macro_Prep_Liabilities"

Access需要运行多个更新查询和多个追加查询,并且需要一段时间才能完成所有操作。有时候这个过程会在大约10分钟后崩溃,有时会在大约5分钟后崩溃,但有时它会正常工作。

整个过程在UNC网络驱动器上运行。我认为这有助于解决这个问题,但我认为这应该有效。有谁知道我怎么能理顺这个?

0 个答案:

没有答案