Article ID: 149936
Article Last Modified on 1/19/2007
'===============================================================
' The GetLinkedDBName() function requires the name of a
' linked 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 GetLinkedDBName (TableName As String)
Dim db As Database, Ret
On Error GoTo DBNameErr
Set db = CurrentDb()
Ret = db.TableDefs(TableName).Connect
GetLinkedDBName = Right(Ret, Len(Ret) - (InStr _
(1, Ret, "DATABASE=") + 8))
Exit Function
DBNameErr:
GetLinkedDBName = 0
End Function
? GetLinkedDBName("Examples")
Note that the path of the linked table's originating database is
displayed in the Debug window.Additional query words: how to
Keywords: kbhowto kbprogramming KB149936