From: Matt Perfetti on
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 ***
From: Salad on
Matt Perfetti wrote:
> 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"

From: Access Developer on
"Salad" <salad(a)oilandvinegar.com> wrote to Matt Perfetti:

>> 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