Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Jan 2025
    Posts
    8

    Question Cannot update linked files on new computer


    I just recently tried moving an Access Database with linked files from my old computer to my new file. When I opened the database on my new computer I could not get access to my linked files in another access database. The 0riginal Database design was that of split Front end-Back end and was originally created in Access 2016. I now have Access 2021 on my new computer. I have tried to update links with the Linked Table Manager but that would not do the job. I don't know if the fact that I tried to put my Access databases on OneDrive has anything to do with the problems I am facing. After doing it I learned that Access databases should not go on OneDrive. I have been trying to get my linked Access database to work for a couple of weeks now with no success. Any help fixing the problem would be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Both files are located in same folder?
    Can open backend independently?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2025
    Posts
    8
    Yes both files are in the same folder and yes I can open my backend database. Roger

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    That is very odd. Could try setting links programmatically. Many examples of code. Here is one:
    Code:
    Sub Relinktables()    Dim dbs As DAO.Database
        Dim tdf As DAO.TableDef
        Dim strTable As String
        Dim LnkDataBase As String
        
        LnkDataBase = "C:\Users\June\AirportsAdmin.accdb"
        Set dbs = CurrentDb()
        For Each tdf In dbs.TableDefs
            If Len(tdf.Connect) > 1 Then 'only relink linked tables
                If tdf.Connect <> ";DATABASE=" & LnkDataBase Then 'only relink tables if they are not linked right
                If Left(tdf.Connect, 4) <> "ODBC" Then 'Don't want to relink any ODBC tables
                    strTable = tdf.Name
                    dbs.TableDefs(strTable).Connect = ";DATABASE=" & LnkDataBase
                    dbs.TableDefs(strTable).RefreshLink
                End If
            End If
        End If
       Next tdf
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Join Date
    Jan 2025
    Posts
    8
    Quote Originally Posted by June7 View Post
    That is very odd. Could try setting links programmatically. Many examples of code. Here is one:
    Code:
    Sub Relinktables()    Dim dbs As DAO.Database
        Dim tdf As DAO.TableDef
        Dim strTable As String
        Dim LnkDataBase As String
        
        LnkDataBase = "C:\Users\June\AirportsAdmin.accdb"
        Set dbs = CurrentDb()
        For Each tdf In dbs.TableDefs
            If Len(tdf.Connect) > 1 Then 'only relink linked tables
                If tdf.Connect <> ";DATABASE=" & LnkDataBase Then 'only relink tables if they are not linked right
                If Left(tdf.Connect, 4) <> "ODBC" Then 'Don't want to relink any ODBC tables
                    strTable = tdf.Name
                    dbs.TableDefs(strTable).Connect = ";DATABASE=" & LnkDataBase
                    dbs.TableDefs(strTable).RefreshLink
                End If
            End If
        End If
       Next tdf
    End Sub
    That seems like a complicated solution which I would not like to take if I do not have too. Would one run this procedure when the Front End form was opened?

  6. #6
    Join Date
    Jan 2025
    Posts
    8
    This solution seems overly complicated, and I would not like to use unless absolutely necessary. When would this procedure be run--when the opening form of the front end database appeared?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Run when you need to set links. I only do it when I move db to another PC. Place code in a general module and cursor within the procedure and click Run > RunSub on VBA editor toolbar.

    Automating this to run when a form opens would require more code that tests if existing links are appropriate and only call procedure if needed and the filepath string would probably have to be dynamic instead of hard-coded as in the example.

    Resetting links shouldn't even be necessary if file paths on each machine are identical.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Join Date
    Jan 2025
    Posts
    8

    Lightbulb

    Quote Originally Posted by June7 View Post
    Run when you need to set links. I only do it when I move db to another PC. Place code in a general module and cursor within the procedure and click Run > RunSub on VBA editor toolbar.

    Automating this to run when a form opens would require more code that tests if existing links are appropriate and only call procedure if needed and the filepath string would probably have to be dynamic instead of hard-coded as in the example.

    Resetting links shouldn't even be necessary if file paths on each machine are identical.
    Yes that sound reasonable and I will it a try. The File paths on the two PC's are not the same. Roger

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Quote Originally Posted by RogerinAnnArbor View Post
    This solution seems overly complicated, and I would not like to use unless absolutely necessary. When would this procedure be run--when the opening form of the front end database appeared?
    Why not just try it instead of complaining?
    Linked manager should work, but you say it did not? You did not supply any error message, so what have you to lose?
    Once the links are set, you do not need to do them again, unless you move files again.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Join Date
    Jan 2025
    Posts
    8

    Red face

    Quote Originally Posted by Welshgasman View Post
    Why not just try it instead of complaining?
    Linked manager should work, but you say it did not? You did not supply any error message, so what have you to lose?
    Once the links are set, you do not need to do them again, unless you move files again.
    "I did try your programmatic solution and it did work. Thanks. However the odd thing it did require a path name involving OneDrive even though I have deleted all Access files from OneDrive cloud and uninstalled the OneDrive application. That puzzle me."

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Do not have your BE on a onedrive, lan only.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Where was the OneDrive reference required? What line of code triggered that? What do your links show for a path?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Join Date
    Jan 2025
    Posts
    8

    Thumbs down

    Quote Originally Posted by Welshgasman View Post
    Do not have your BE on a onedrive, lan only.
    "I now wish I had never gone on OneDrive but cannot seem to fix its continuing negative influences on Windows 11 in my new PC. Uninstalling OneDrive and deleting files from the OneDrive cloud have not cleaned matters on my PC."

  14. #14
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,823
    Hi
    Have you tried moving all files from One Drive into a folder in My Documents?

  15. #15
    Join Date
    Jan 2025
    Posts
    8

    Question

    Quote Originally Posted by mike60smart View Post
    Hi
    Have you tried moving all files from One Drive into a folder in My Documents?
    "As far as I know there are now no more Access files in the cloud on OneDrive. I have put all my Access files in the Documents folder (says stored locally) but to access them programmatically I had to use the path
    c:\users\rkuhl\OneDrive\Documents\Access Files\. That location does not even appear in the File Explorer. I wonder if Windows 11 in conjunction with OneDrive has put my Access files in a very strange place."

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-15-2023, 02:16 PM
  2. Importing Data from Home Computer to Work Computer
    By wam18jr in forum Import/Export Data
    Replies: 5
    Last Post: 11-06-2017, 06:59 PM
  3. Replies: 5
    Last Post: 03-30-2016, 12:42 PM
  4. Replies: 4
    Last Post: 11-29-2012, 12:45 AM
  5. Replies: 1
    Last Post: 05-25-2012, 10:36 AM

Tags for this Thread

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