How to export a CSV file with headers?

W

WDSnews

I've just upgraded our company to MSO 2007. Now it's time to submit our
quarterly data to the district and I can't find a way to make Access export
with column headers. What's the trick to creating this common data format?
 
A

Allen Browne

WDSnews said:
I've just upgraded our company to MSO 2007. Now it's time to submit our
quarterly data to the district and I can't find a way to make Access
export with column headers. What's the trick to creating this common data
format?

This hasn't changed. The code is like this:
DoCmd.TransferText acExportDelim, , "Query1", "C:\MyFolder\MyFile.csv", True

If you are having trouble finding the TransferText action in a macro,
depress the Show All Actions button on the ribbon. (Anything Microsoft
considers unsafe is hidden by default.)
 
A

Albert D. Kallal

Thank you for the code. Is the GUI export just gone now?

The export via GUI should work as before. I think there was just a little
bit confusing on your side, and we assume that your tiny use a macro or some
code to do the export, because when you use the you why, it's quite easy to
export with the headings.

Simply highlight your query or table, and then in the ribbon group there is
a large tab called "External data" (seems a appropriately named to me).
Simply click on the tab, and you see a bunch of options/buttons in the
export "group" of controls. A "csv" file is considered a text file. IT IS
VERY important that you name the extension "csv" else you will NOT see the
old wizard we had for the last 10+ years of using ms-access. Once you enter
the csv file name, then click ok (do not check the 'export data with
formatting any layout).

Once you do the above...then you get the old style wizard with (1st page
allows you to select fixed, or comma delimited. Hit next...and you see the
page with the check box to include field names...

So as far as I can tell the UI not really changed from previous versions,
but you do have to type in the appropriate file extension else the wizard
will not launch...
 
A

AFSSkier

I have a similar export question. I currently have the following code to
export a Tab Delimited file using a Tab Export Spec. I want to email the
same Tab Delimited file.

Code:
DoCmd.TransferText acExportDelim, "Auth_item(Tab) Export Spec",
"auth_item", "\\Slcinternet\CLS\auth_item.txt", False, ""

'Here's were the code needs to change to reflect the Tab Delimited file.
DoCmd.SendObject acTable, "auth_item", "MS-DOSText(*.txt)",
"(e-mail address removed)", "", "Authorized Items", "Per your request, attached is a
copy of the updated flat file.", True, ""
 

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