Linked Table value

  • Thread starter Thread starter hmlim
  • Start date Start date
H

hmlim

Hi, all
anybody know how to get a linked table path value using VBA code?
I have a table is a linked table, inside my VBA code, I need to know
where the external source for linked table, can anybody help?


hmlim
 
Here is some DAO code that will do waht you need:

Dim db As Database
Dim varTable As Variant
Dim strTableName As String
Dim strFileAndPath As String
Set db = CurrentDb
For Each varTable In db.TableDefs
If Len(varTable.Connect) > 1 Then 'its a linked table
strTableName = varTable.Name
'linked tables start with ";DATABASE="
'so we need to strip that away
strFileAndPath = Mid(varTable.Connect, 11, Len
(varTable.Connect) - 10)
End If
Next
Set db = Nothing

-Cameron Sutherland
 
Back
Top