Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Path to linked tables (Access 2003)

    In a split database setup (front end/back end), is there a command in VBA that can retrieve the path of linked tables ?
    (Just as Application.CurrentProject.Path retrieves the path of the fornt end file).

    Can't seem to fnd anything in the knowledge base other than references to the linked table manager (I do not wish to start this wizard for this particular case).

    Thanks. Claude

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Path to linked tables (Access 2003)

    The DAO TableDef object has a property Connect. If the table is not linked, this property is an empty string, but if the table is linked, it will look like
    <code>
    ;DATABASE=C:FolderDatabase.mdb
    </code>
    You can use InStr to extract the name and path of the database. For example:
    <code>
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim strConnect As String
    Dim intPos As Integer

    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs("tblLinked")
    strConnect = tdf.Connect
    If strConnect = "" Then
    MsgBox "Table is not linked.", vbInformation
    Else
    intPos = InStr(strConnect, "=")
    MsgBox "Table is linked to " & Mid(strConnect, intPos + 1)
    End If
    </code>
    Note: you need a reference to the Microsoft DAO 3.6 Object Library (in Tools | References).

  3. #3
    New Lounger
    Join Date
    May 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Path to linked tables (Access 2003)

    Thanks Hans. This is exactly what I needed. Claude

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •