Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automatically produce a .csv file from Access Database?

Status
Not open for further replies.

rostik

Programmer
May 17, 2001
20
US
Hi All,
What would be a best way to automatically produce a .csv file from Access Database?

Thanks
 
Hi!

Select the table or query you want to save and go to file and save as. You will want to export to file and when the save as box comes up you will need to change the file type to text files which includes .csv. This will activate a wizard and you will be able to specify how you want the file saved. There will be an advanced button and you will want to click on that. There you will have another save as button which will allow you to save a specifications file. Once you have the specifications file saved, you can use the TransferText Action (in a macro) or Method (in VBA) and use the specifiction file name where indicated. Now whenever you run the macro, or code, the file will be exported to your specifications.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff:

Doesn't the transfer text method automatically created a comma delimited text file if you choose the acExportDelim option?

DoCmd.TransferText acExportDelim, , "TableOrQueryToExport", "PathAndNameOfFileToCreate", -1

Or am I missing something?

Uncle Jack

 
Hi Uncle Jack!

The transfertext method does automatically create a comma delimited file, but it also puts "" around and text field in the output. Most people don't want the quotes so that is why I recommended the creating the specification file. By all means, if transfertext creates exactly what is wanted, use it without the specification file.

Jeff Bridgham
bridgham@purdue.edu
 
Thanks guys very much!
It works both ways.
Rostik
s-)
 
Jeff:

Yes, I think you're correct about enclosing text data in quote marks; other fields seem exempt. I have found though that I can still import and use the data in either Excel or Word and the quotes aren't a bother. However, it's nice to know there's an easy method around this if the need arises.

Uncle Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top