Remote Server Errors

Remote Server Errors

dbrblg
Collaborator Collaborator
462 Views
0 Replies
Message 1 of 1

Remote Server Errors

dbrblg
Collaborator
Collaborator

Hi, 

 

Has anyone suffered from run-time error 462 'the remote server machine does not exist or is unavailable' when using Access vba?

 

I am using access vba to open many assembly files to update them and then save them.  The code gets a list of assemblies from a database and iterates through each one opening them up, updating and finally saving then closing the document.

 

After an indeterminate number of assemblies, Inventor suddenly shuts down and gives me the error above.

 

I have included the code I am using below:

 

Dim rs As ADODB.Recordset
    Dim cn As ADODB.Connection
    Dim cm As ADODB.Command
    Dim InvAppDoc As Inventor.AssemblyDocument
    Dim i As Long

    i = 0
    
    If (InvApp Is Nothing) Then
        Set InvApp = StartInventor()
    End If
    
    Set cn = New ADODB.Connection
    Set cn = CurrentProject.Connection

    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient

    Set cm = New ADODB.Command
    cm.ActiveConnection = cn

    cm.Parameters.Append cm.CreateParameter("@FileLinksChecked", adBoolean, adParamInput, 1, 0)
    cm.Parameters.Append cm.CreateParameter("@FileExtension", adWChar, adParamInput, Len("iam"), "iam")

    If (lngCount <> 0) Then
        cm.CommandText = "SELECT TOP " & lngCount & " FullPath FROM InventorFiles WHERE (FileLinksChecked=@FileLinksChecked AND FileExtension=@FileExtension);"
    Else
        cm.CommandText = "SELECT FullPath FROM InventorFiles WHERE (FileLinksChecked=@FileLinksChecked AND FileExtension=@FileExtension);"
    End If

    Set rs = cm.Execute

    Do Until (rs.EOF Or bCancel)

        If (GetAttr(rs.Fields("FullPath").Value) And vbReadOnly) Then
            Call SetAttr(rs.Fields("FullPath").Value, 0)
        End If
        
        Set InvAppDoc = InvApp.Documents.Open(rs.Fields("FullPath").Value)
        
        Call InvAppDoc.Update2(True)
        
        Call InvAppDoc.Save2(True)
 
        Call InvApp.ActiveDocument.Close(False)

        Call UpdateInventorFileAsChecked(rs.Fields("FullPath").Value)
        
        rs.MoveNext
        
    loop
    
    InvApp.Quit
    
    Set InvApp = Nothing
    Set InvAppDoc = Nothing

 

Does anyone know why this is being caused?

 

Thanks

0 Likes
463 Views
0 Replies
Replies (0)