Results 1 to 3 of 3
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    How to Change the Link-To File Name for a Table linked to a Text File

    I have a table with fixed length fields that is linked to an external text file. I want the operator to be able to select a different file and replace the connection name to the selected file name. For example, the table is currently linked to a file named C:\Temp\January.txt. I want the operator to be able to designate the file C:\Temp\March.txt and then I want to re-link the table to the new file name using VBA.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    See if this helps you.
    Rogers Access Library:

    LinkTextFiles.mdb (intermediate)
    http://www.rogersaccesslibrary.com/forum/topic333.html

  3. #3
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    Apparently you can't change the TableSource once the table is created. The method above removes the table from the TableDefs collection, re-creates it with the new name and specs, then adds the new table to the TableDefs collection.

    I am going to use a different approach. I'm going to link the table to a file named something like "TheFile" and then when the operator selects the actual file he/she wants, I'm going to use FileCopy to copy the selected file to "TheFile".

    Thanks for the help, Eddie

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

Similar Threads

  1. How to update table if linked ot text file
    By cory_jackson in forum Import/Export Data
    Replies: 7
    Last Post: 01-03-2012, 03:19 PM
  2. Linked file text/numeric filter performance
    By awc109 in forum Import/Export Data
    Replies: 0
    Last Post: 04-19-2011, 11:02 AM
  3. Text File Link
    By pkell658 in forum Import/Export Data
    Replies: 1
    Last Post: 03-23-2010, 04:46 PM
  4. Replies: 3
    Last Post: 01-15-2010, 02:28 PM
  5. Link table using MAC PC file sharing problem
    By TaiYipStreet in forum Access
    Replies: 0
    Last Post: 07-19-2006, 08:02 AM

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