The connect strings for text files are a bit more complicated than for
linked Access (Jet) tables. The pattern you are using only applies to
Jet tables. Take a look at the existing connect string by bringing up
the table in design view and looking at its properties. In the
Description field you will see something like (all on one line):
Text;DSN=Delim Link
Specification;FMT=Delimited;HDR=NO;IMEX=2;DATABASE=C:\appdev\Acc1\Samples\L
ab02;TABLE=Delim#txt
The above would be a typical pattern for a link to a file called
Delim.txt, created with the wizard. The last part (Table=...) is the
SourceTableName that Dev referred to. The rest is the Connect property
value.
You may find it easier to delete the existing link and use
DoCmd.TransferText to create a new one.
-- Andy
Quote:
>Using this code, how can I refresh the link of a csv file?
>Set tdf = db.TableDefs(strTablename)
>tdf.Connect = ";DATABASE=" & PathName
>tdf.RefreshLink
>I have a form that the user can type in a path and file name and then
>refresh the links. This code works great for Access database tables. I tried
>to change the code to refresh csv files but all I got was error messages.
>I am using Access 97.
>Thanks In Advance
>Lou Civitella
>Weber Systems, Inc.