Results 1 to 5 of 5
  1. #1
    Wiggles8831 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    3

    Redirect multiple Linked Tables using VBA

    I have 25 linked tables linked to text files in MS Access. I would like to make a VBA module that will redirect/relink all the tables to a different file extension. Below is a sample of what the linked tables' paths currently look like (there are 25):
    C:\External\Company1\Submissions\20120103
    C:\External\Company2\Submissions\20120103
    C:\External\Company3\Submissions\20120103
    C:\External\Company4\Submissions\20120103
    C:\External\Company5\Submissions\20120103

    The list of all 25 companies resides in a table called CompanyList.


    What I would like to happen when I run the module is to have a window pop up where I can edit the final portion of the file extension, e.g. change \20120103 to \20120110 for all 25 linked tables.
    I'm thinking something like "C:\External\" + [COMPANYLIST] + \ [input from pop up window].
    I use basic SQL coding all the time, but I'm definitely just a beginner at VBA, so any help would be greatly appreciated!
    Thank you!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Code to programmatically modify table links in this thread http://forums.aspfree.com/microsoft-...ue-323364.html
    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
    Wiggles8831 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    3
    Thanks for the pointer June, definitely a start.

    My big issue is that all my files aren't stored in the same file directory.

    C:\External\Company1\Submissions\20120103
    C:\External\Company2\Submissions\20120103

    C:\External\Company3\Submissions\20120103

    Is there a way that I can update everything to the left and to the right of \CompanyX\ and use a table to fill in all 25 different values for the company?

  4. #4
    Wiggles8831 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    3
    Nevermind, I figured it out. Thanks!

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, you could open a recordset of the table and loop through the recordset and concatenate the field into the Old and New path strings. I am guessing that was your solution.
    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.

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

Similar Threads

  1. Replies: 5
    Last Post: 02-02-2012, 06:42 PM
  2. Replies: 5
    Last Post: 12-19-2011, 02:53 PM
  3. Replies: 2
    Last Post: 11-05-2010, 04:47 AM
  4. Replies: 3
    Last Post: 06-14-2010, 06:48 PM
  5. Replies: 1
    Last Post: 08-19-2009, 01:14 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