Full Version: TransferText Export CSV: need column headers
UtterAccess Discussion Forums > Microsoft® Access > Access Macros
chongman99
I want a general solution to the following problem:

PROBLEM: Export all tables in an .mdb file to CSV ***with column headers***
PARTIAL SOLUTION: I've successfully exported all the tables using a for each loop. The code for my solution is here:

http://opensourceeconomics.wordpress.com/2...umption-survey/

But the thing I can't get is to get the column headers to appear.

I have searched utteraccess and google for solutions, but haven't found one. Two posts on UA are helpful:

*** http://www.utteraccess.com/forums/showflat...;Number=1736578
discusses schema.ini a little, but then found the error was in another argument to TransferText.


*** http://www.utteraccess.com/forums/printthr...amp;type=thread
talks about where the specification is stored. (i.e., we can't find it except via the menus) I couldn't find the schema.ini file. I did note that while running the script, a file called export.ini file was created temporarily but then erased.. The other thought is to close all applications, save a new schema, and then look for any files changed in the last 5 minutes; then grep them to find the schema header(???)

BTW: If you want to look at the mdb that I'm using as source data, download it here: http://www.eia.doe.gov/emeu/recs/recs97/publicaccess.html

Thanks!
jwhite
Are you not using the TransferText Method? It has an argument for including field names as the header.

Edit: Duh, re-read title -- you are... Have you tried using that argument for fields?
chongman99
QUOTE
Are you not using the TransferText Method? It has an argument for including field names as the header.

Edit: Duh, re-read title -- you are... Have you tried using that argument for fields?


You are a genius (and I am bad at reading documentation). You solution is 100% correct and I am changing my post and linking back to this page. Thanks!!!
jwhite
thumbup.gif

By the way, Welcome to UA! -o!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.