Results 1 to 3 of 3
  1. #1
    jcc285 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    70

    Refresh linked tables on startup

    I have two problems, if I could solve the first one the second one disappears.

    1. I have a split database with 50 + tables. The tables are in a folder C:\Database\Back End. When I change the front end of the database, C:\Database\Front End, having redesigned a form for example, all existing table links work fine with the exception of one table. The missing table appears in the table list in the Front End and is shown as linked. My Front End though reports that the table is not there. When I run Table linking manager to re-create the link the table is in the list and looks no different to any other. The only way is to run the Link Manager which I cannot expect my users to do, however, all then works fine.

    2. To get round this I attempted to Re-link the tables on Startup within my 'Splashscreen' as follows
    Private Sub ....................
    'Make sure tables are correctly linked
    'Set Database variables
    Dim dbCurrent As DAO.Database
    'Dim Tdf As DAO.TableDef
    'Dim Tdfs As DAO.TableDefs
    'Dim NewPathName As String
    Set dbCurrent = CurrentDb()
    Set Tdfs = dbCurrent.TableDefs
    NewPathName = "C:\Database\Back End"
    For Each Tdf In Tdfs
    If Not (Tdf.Name Like "MSys*") Then
    Tdf.Connect = ";DATABASE=" & NewPathName
    Tdf.RefreshLink
    End If
    Next
    Set Tdf = Nothing
    Set dbCurrent = Nothing
    End Sub

    When this runs I get a 3051 error with the Debugger stopping at the Tdf.RefreshLink line.

    I have noticed that all folders are tagged as Read Only and I don't seem to be able to remove this. If I do remove it it just comes back again !

    Any help gratefully received.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    i use:

    Code:
    dim tdf as tabledef
    dim db as database
    
    set db  = currentdb
    For Each tdf In db.TableDefs
       If tdf.Connect <> "" Then      tdf.RefreshLink
    Next

  3. #3
    jcc285 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    70
    Thank you, that's sorted it. I don't know why one table loses the link but this puts it back.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Refresh Linked Tables using new credentials
    By nvrwrkn in forum Programming
    Replies: 3
    Last Post: 10-22-2012, 01:32 PM
  2. Refresh Linked Sharepoint List to Show New Records
    By gopherking in forum Programming
    Replies: 1
    Last Post: 03-21-2012, 07:59 AM
  3. Automatically Refresh datasheet/tables
    By akira in forum Access
    Replies: 4
    Last Post: 02-07-2012, 01:39 PM
  4. Replies: 5
    Last Post: 02-02-2012, 06:42 PM
  5. linked table refresh in 2010 not working in 2000
    By bbbeng in forum Import/Export Data
    Replies: 3
    Last Post: 12-20-2011, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums