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

xlguy

New Member
Joined
Mar 17, 2015
Messages
18
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:

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 = "[URL="file://\\CATOU-OGFSPUWSX\rosec$\G\EIRS_Demo\WFP-TESTING.accdb"]\\CATOU-OGFSPUWSX\rosec$\G\EIRS_Demo\WFP-TESTING.accdb[/URL]"
    '--- 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!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Don't use the double backslashes for the network drive. Just use the letter of the drive on your machine. Like just write: "G:\EIRS_Demo\WFP-TESTING.accdb"

or whatever drive letter it is.
 
Upvote 0
Thanks SvenDiamond...for your reply!

So do you think that that is indeed the problem...or is it just something that you think I should try? If it is the latter, then I'll only be able to try it out on Tuesday January 3rd, when I get back in to work.

Later
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top