importing from tab separated text file

G

Gary Roach

i want to import data from a tab separated text file. i can do this with the
wizard no problem and it recognizes the tabs a delimiters. however, when i
try it with vba, it ignores the special meaning of the tabs and treats the
entire line of the text file as one field. here's the code:

DoCmd.TransferText , , "testout2", "C:\Documents and
Settings\gary\Desktop\d & s thetics\testout.tab", True

i even gave the file a .tab extension to give the program a hint that it's
tsv. i can't find anything in the on-line doc to tell the command what the
delimiter is. any ideas? all help is greatly appreciated.

gary
 
C

Cheryl Fischer

When you are in the Wizard doing the import, you can name and save an Import
Specification (highly recommended) by clicking the "Advanced" button and
following the prompts. Then, when you need to run the import from VBA,
insert the name of your Import Specification in your TransferText code just
before the Table Name.

hth,
 
G

Gary Roach

thanks for the info. it worked the way i wanted it too (almost). the command
seems to ignore the "hasfieldnames" argument. i set it to true but when it
imports the data it just ignores the first row - it doesn't set the field
names to those in the first line of the input file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top