dbTalk Databases Forums  

Cannot Output Table to csv format

comp.databases.ms-access comp.databases.ms-access


Discuss Cannot Output Table to csv format in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matt Perfetti
 
Posts: n/a

Default Cannot Output Table to csv format - 07-15-2010 , 10:10 AM






I cannot output a table in Access 2003 or Access 2007 as a step in a
macro in a comma seperated file format. The option is not there. I
converted the macro to Visual Basic and changed the code to:

DoCmd.OutputTo acTable, "On Hand Table Copy", "Comma Seperated Values
File(*.csv)"

But it errors out because the format is not available. Is this just not
possible at all? This macro needs to run several times a day for an
import, so saving the export file from an available format (.xlsx) to a
csv every time is not practical.



*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Cannot Output Table to csv format - 07-15-2010 , 11:28 AM






Matt Perfetti wrote:
Quote:
I cannot output a table in Access 2003 or Access 2007 as a step in a
macro in a comma seperated file format. The option is not there. I
converted the macro to Visual Basic and changed the code to:

DoCmd.OutputTo acTable, "On Hand Table Copy", "Comma Seperated Values
File(*.csv)"

But it errors out because the format is not available. Is this just not
possible at all? This macro needs to run several times a day for an
import, so saving the export file from an available format (.xlsx) to a
csv every time is not practical.

Maybe Docmd.TransferText will work.
From Help's example
DoCmd.TransferText acExportDelim, "Standard Output", _
"External Report", "C:\Txtfiles\April.doc"

Reply With Quote
  #3  
Old   
Access Developer
 
Posts: n/a

Default Re: Cannot Output Table to csv format - 07-16-2010 , 05:46 PM



"Salad" <salad (AT) oilandvinegar (DOT) com> wrote to Matt Perfetti:

Quote:
DoCmd.OutputTo acTable, "On Hand Table Copy",
"Comma Seperated Values File(*.csv)"

But it errors out because the format is not available.
Is this just not possible at all?
If you place the cursor on "Output To" and press F1 for Help, you'll see
that neither "acTable" nor "Comma Seperated Values File(*.csv)" are valid
parameters. Using a text file, and the valid parameters, I got a nicely
drawn text table, and you have little control over what you get with
"OutputTo". Thus, Salad's suggestion of DoCmd.TransferText is a much better
approach.

To export my table, I used the following statement:

DoCmd.OutputTo acOutputTable, "APeople", acFormatTXT, "APeopleAsText.txt"

and you will note that the valid arguments for this funtion are
"acOutputTable" and "acFormatText", just as described in the Help. But, the
output was far from CSV. However, you can exercise sufficient control with
..TransferText to do what you want. Remember: "Help is your friend."

Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.