Article ID: 116146
Article Last Modified on 11/6/2000
'***************************************************************
' Declarations section of the module.
'***************************************************************
Option Explicit
'===============================================================
' The GetAttachedDBName() function requires the name of an
' attached Microsoft Access table, in quotation marks, as an
' argument. The function returns the full path of the originating
' database if successful, or returns 0 if unsuccessful.
'===============================================================
Function GetAttachedDBName (TableName As String)
Dim db As Database, Ret
On Error GoTo DBNameErr
Set db = DBEngine.Workspaces(0).Databases(0)
Ret = db.TableDefs(TableName).Connect
GetAttachedDBName = Right(Ret, Len(Ret) - (InStr_
(1, Ret, "DATABASE=") + 8))
Exit Function
DBNameErr:
GetAttachedDBName = 0
End Function
Keywords: kbhowto kbinterop kbprogramming KB116146