The remote server machine does not exist or is unavailable

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
I am running some code by clicking a command button on a form. Here is the code.

Code:
Public Sub ImportHealthandSafety()
    
    Dim appAccess As Access.Application
    Dim strData As String, strDatabaseFile As String
    Dim bln As Boolean
    Dim intRows As Integer, x As Integer
    
    On Error GoTo ErrorHandler
    
    strDatabaseFile = "C:\Users\Aziz.Rasul\Scheduling Database - Front End.accdb"
    intRows = ThisWorkbook.Sheets("New MSS").Cells(Rows.Count, 1).End(xlUp).Row

    bln = DoesFileExistinFolder2(strDatabaseFile)
    
    If bln = False Then
        strDatabaseFile = FilePicker(CurDir(), "SELECT DATA SOURCE", "Access 2010 or Later Databases, *.ACCD*")
    End If
            
    Set appAccess = New Access.Application

    With appAccess
        .OpenCurrentDatabase strDatabaseFile
        .Visible = True
        For x = 3 To intRows
            ThisWorkbook.Sheets("New MSS").Range("AB" & x) = Nz(.Run("ImportLandParcelHazardData", ThisWorkbook.Sheets("New MSS").Range("D" & x)), "")
        Next x
    End With
    
    With appAccess
        .CloseCurrentDatabase
        .Quit
    End With
    
ErrorHandler:
    If Err.Number <> 0 Then
        MsgBox Err.Number & " - " & Err.Description
'        Resume Next
    End If
    
End Sub

I am, consistently getting an error 462 (The remote server machine does not exist or is unavailable) on line

Code:
ThisWorkbook.Sheets("New MSS").Range("AB" & x) = Nz(.Run("ImportLandParcelHazardData", ThisWorkbook.Sheets("New MSS").Range("D" & x)), "")

as it runs the code in the database.

The MS Access database opens up with a form initially.
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
OK I think I know why it isn't working, I am using the Nz function in Excel which is a Access function.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

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