Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    144

    Unanswered: linked tables address problemm

    hi
    in my app i separated tables database from interface.no in interface file i had some linked tables. i put both files (interface & data file) in same directory. in add external data i didnt use complete address, i only types data file name. so it must be ok when i change the app directory. but when i try to open interface file in other PCs with different address, it still try to find data file from the same address in my pc. & user must add external data again.
    even when i get the the property of linked tables, it shows my PCs address.
    is it access bug or something?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Here is a function that allows to modify the path of the attached tables when you move both the front-end and the back-end files. It works only if:

    1. All the attached tables are in one or more databases (back-end(s)) located in the same folder as the front-end.

    2. All the attached tables are from one or more Access back-end.
    Code:
    Function RelinkTables()
    
        Dim tdf As DAO.TableDef
        Dim strPath As String
        Dim strDb As String
        
        For Each tdf In CurrentDb.TableDefs
            If Len(tdf.Connect) Then
                tdf.Connect = Left(tdf.Connect, InStr(tdf.Connect, "=")) & CurrentProject.Path & Mid(tdf.Connect, InStrRev(tdf.Connect, "\"))
                tdf.RefreshLink
            End If
        Next
        Set tdf = Nothing
                    
    End Function
    Have a nice day!

  3. #3
    Join Date
    May 2004
    Posts
    144
    & where i should use this func? plz describe a little more, i'm new in access

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    It could be called every time your application starts, but in this case I would perform a test first, or you can call it just when you move the files.
    Have a nice day!

Posting Permissions

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