azizrasul
Well-known Member
- Joined
- Jul 7, 2003
- Messages
- 1,304
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I am running some code by clicking a command button on a form. Here is the code.
I am, consistently getting an error 462 (The remote server machine does not exist or is unavailable) on line
as it runs the code in the database.
The MS Access database opens up with a form initially.
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: