Link to home
Start Free TrialLog in
Avatar of avoorheis
avoorheis

asked on

transfertext will not include column headers when using tab delimited format

I had this issue before and just can't remember how I resolved it.
I have a very simple table and I just want to transfer it to a text file that is tab delimited and include the headers. I've tried both a macro and vba and am using a specificaiton. If I don't use the specification, the headers are transfered, but, of course, it's a coma separated file.
I made a test database and attached.

Any ideas?
thanks Test1.accdb
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

This seems to work ... no spec

Function exporttable()
DoCmd.TransferText acExportDelim, , "TestExport", "c:\TestExport12.txt", True
End Function

mc
Avatar of avoorheis
avoorheis

ASKER

but it's creating a csv and not a tab delimited file?
Changed the Export spec, it looks like the headers where not added in the Export spec.

See attached database:

Test1.accdb
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have changed the Macro btw.
See image file:
 User generated image
thanks Cap
Please tell me what you did. I can see no difference between your spec and mine except for quoting text, and, even when I change my spec for no quotes it does not show the headers. As far as I can tell, the spec has nothing to do with the headers, which should be controlled by either the "has field names" in either the macro or transfertext vba command.

For the others, here's the output I was looking for, include headers and tab delimited:
Test1      Test2      Test3
1      Hello      a
2      bye      b
Did you checked the attachment I posted, change the Macro according your path, and then let me know the outcome.
Tested it, and the output is with headers, and exactly the way you described.

you have to check, "include field names on first row" when doing the import using the wizard for the first time.
then click the Advanced button to save the Export specification...
thanks
so, it seems if I don't use "include field names on first row" check box the first time I create a spec, I can't go back to that spec and change it or even try to update it and rename it or even delete it.
Hi dan,
I think I just look at your snapshot, which shows a csv output, which is not what I wanted and was able to get that originally. However, I just tried your example database and it does produce a tab delimited output.