spencer.67965
2005-02-14, 09:29 PM
Hello all,
I am trying my hand trying to accessing data from a "Microsoft Access 2000" database from AutoCAD 2005. My purpose is to pull some information from a specified table and then return the value to AutoCAD as a Variable for further manipulation. It works great the first go around then I get this error:
Run-time error '462':
The remote server machine does not exist or is unavailable.
Does anyone know what could be causing this to happen? Also if I exit out of AutoCAD and then get back into AutoCAD and run the macro again it works fine the first go around then it give the same error.
Here is my code thus far.
-------------------------------
Public Sub TestAccess()
Dim acApp As Access.Application
Dim AcuteDatabase
Dim ID
Dim ClientName
AcuteDatabase = "y:/test.mdb"
ID = 1
Const ERR_APP_NOTRUNNING As Long = 429
On Error Resume Next
' Attempt to reference running instance of Access.
Set acApp = GetObject(AcuteDatabase, "Access.Application")
' If Access isn't running, create a new instance.
If Err = ERR_APP_NOTRUNNING Then
Set acApp = New Access.Application
End If
ClientName = DLookup("[field1]", "[table1]", "[id]=1")
If Not acApp.UserControl Then
acApp.Quit
Set acApp = Nothing
End If
End Sub
-------------------------------
Let me know if any more clarification is required.
Thanks in advance
I am trying my hand trying to accessing data from a "Microsoft Access 2000" database from AutoCAD 2005. My purpose is to pull some information from a specified table and then return the value to AutoCAD as a Variable for further manipulation. It works great the first go around then I get this error:
Run-time error '462':
The remote server machine does not exist or is unavailable.
Does anyone know what could be causing this to happen? Also if I exit out of AutoCAD and then get back into AutoCAD and run the macro again it works fine the first go around then it give the same error.
Here is my code thus far.
-------------------------------
Public Sub TestAccess()
Dim acApp As Access.Application
Dim AcuteDatabase
Dim ID
Dim ClientName
AcuteDatabase = "y:/test.mdb"
ID = 1
Const ERR_APP_NOTRUNNING As Long = 429
On Error Resume Next
' Attempt to reference running instance of Access.
Set acApp = GetObject(AcuteDatabase, "Access.Application")
' If Access isn't running, create a new instance.
If Err = ERR_APP_NOTRUNNING Then
Set acApp = New Access.Application
End If
ClientName = DLookup("[field1]", "[table1]", "[id]=1")
If Not acApp.UserControl Then
acApp.Quit
Set acApp = Nothing
End If
End Sub
-------------------------------
Let me know if any more clarification is required.
Thanks in advance