TransferText method fails to recognize tabs in tab-delimited heade

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Linking to file using menus works fine, but the following code fails:

DoCmd.TransferText acLinkDelim, , "Jimbo",
"\\Newdell\BU\LinkFiles\aCASEN220Sprg2005.txt", True

It creates a linked table with all the tabs in the header row replaced with
Underbars and the entire header row in the first column. Additional columns
are named F1, F2, etc. but number of columns well short of requirement.
Subsequent rows have embedded tab characters.

Any thoughts?
 
Jim Molter said:
Linking to file using menus works fine, but the following code fails:

DoCmd.TransferText acLinkDelim, , "Jimbo",
"\\Newdell\BU\LinkFiles\aCASEN220Sprg2005.txt", True

It creates a linked table with all the tabs in the header row replaced with
Underbars and the entire header row in the first column. Additional columns
are named F1, F2, etc. but number of columns well short of requirement.
Subsequent rows have embedded tab characters.

Any thoughts?

You need to create an Import/Export specification. You can do this by
clicking the "Advanced" button in the import/export wizard. Once you've
created a specification, you identify it by name in the second argument of
the TransferText method.
 
Thanks Brian! Using an import spec was my earlier solution. Unfortunately,
the number and position of columns in the tab-delimited file has proven
unreliable, so my fall-back was to use the "first row contains field names"
alternative. I suspect that there's some attribute of the text file that
causes it to fail. If I knew what it is, I might be able to write a
workaround.

Thanks for your help!

Jim
 
Jim Molter said:
Thanks Brian! Using an import spec was my earlier solution. Unfortunately,
the number and position of columns in the tab-delimited file has proven
unreliable, so my fall-back was to use the "first row contains field names"
alternative. I suspect that there's some attribute of the text file that
causes it to fail. If I knew what it is, I might be able to write a
workaround.

Thanks for your help!

Jim

From your original description, it seems to me that the problem is that it
is failing to recognise the tab delimiters. I think that, unless you
indicate otherwise by means of a specification, it will assume that the file
is comma delimited.
 
Back
Top