PDA

View Full Version : Run-time error '462': The remote server machine does not exist or is unavailable



new2code
12-30-2016, 09:20 PM
Hello all,

Hoping someone can help me resolve the following error, that I encounter every consecutive time I try to run the below code.

---------------------------------------------------------------------
Run-time error '462':
The remote server machine does not exist or is unavailable
---------------------------------------------------------------------

The error is normally displayed against the statement that reads "Set ws = DBEngine.Workspaces(0)".

Offending code:



Sub copyCMdataToAccessDB()
Application.StatusBar = "Now exporting 'Current Data' to Access database..." Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim sDb As String
Dim sSQL As String
Dim qdf As QueryDef
sDb = "\\CATOU-OGFSPUWSX\rosec$\G\EIRS_Demo\WFP-TESTING.accdb"
'--- On Error Resume Next
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(sDb)
' A stored query would be better
sSQL = "Parameters p1 Text, p2 Datetime; " _
& "INSERT INTO Table1 (AText,ADate) Values ([p1],[p2])"

Set qdf = db.CreateQueryDef("", sSQL)
qdf.Parameters!p1 = "ABC"
qdf.Parameters!p2 = #1/17/2013#
qdf.Execute dbFailOnError
Debug.Print qdf.RecordsAffected

Access.Quit
'--- On Error GoTo 0

Application.StatusBar = ""
End Sub



Upon Googling around, I believe it might have something to do with "unqualified references"...but I cannot seem to figure out where I have unqualified references in my code.

Thanks in advance.

Happy New Year to all you wonderful folks here!