?
Solved

cannot change linked text file path

Posted on 2013-12-16
5
Medium Priority
?
696 Views
Last Modified: 2013-12-17
hi guys,

i've a linked textfile in my database and i'm trying to change this link path to the new text files that are generated every day.

here is my database and the 2 text files attached.

i have some code for this but when it wasn't working, i tried reducing everything back to basics - e.g. not using code by relinking the text file by hand.

when i tried to relink the text file by going to the link manager, i realised even though i chose the other text file i could not relink it.

question --> 1) can linked text files have their paths changed?
2) how can i do this in code? e.g. if i can't just simply change the path, how can i create a linked text file through vba?

thanks guys!
TextFileLInking.zip
0
Comment
Question by:developingprogrammer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 1600 total points
ID: 39721023
That is because what you relink is not the table but the database, and for text files the "datebase" is the folder, thus the connect string doesn't contain the file name.

The file name is hold in the SourceTable property which you can't refresh.
You have to delete the old link and recreate it using the new file name.

Also, note the link uses the 8.3 (short) file name, so you may get in trouble with long file names.

To relink to another file, it must be placed in another folder and have the same (short) file name as the original.

/gustav
0
 

Author Comment

by:developingprogrammer
ID: 39721101
Whao gustav!! I would have never figured that out in a million years!!

the short name probably also explains the error 3011 that arises when I have multiple .s in my file name when I use transfertexf. What fantastic gustav, thanks so much for your help = )
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 39721120
You are welcome!

/gustav
0
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 400 total points
ID: 39721143
What I do for this is have a working "scratch" file in a known location.

I then kill the scratch file and copy my input file to that scratch file spec and continue on.

Jim.
0
 

Author Comment

by:developingprogrammer
ID: 39725805
hey gustav i read up a bit on the 8.3 short file name on wiki and that's really cool. i'm not sure how i would ever come across this 8.3 short file name if you didn't mention it ha. haven't had time to go through the whole thing but really interesting and helpful. thanks once again!! = ))

thanks for your help Jim! in the end i resorted to the DoCmd.TransferText function cause i think linking to a textfile is less stable than importing it in - as in one fixed state to another fixed state. something like deterministic state. DFSM i think it's called - not sure if i'm using it correctly though ha. but thanks for your sharing!! = ))
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question