Solved

How to Programatically export comma delimted to CSV

Posted on 2010-09-22
5
1,119 Views
Last Modified: 2012-08-13
I tried to programatically export to a CSV file, comma delimted, but the following didn't produce the results I expected.  The DoCmd I am using below doesn't export as comma delimted.

DoCmd.OutputTo acOutputTable, "tbl Export Current Charges", acFormatCSV, "C:\Siemens\Xport_HistoryData\20100831\ELA\MYTEST_CHARGES.CSV"

I have about 10 tables that are exported weekly and the varDateFolder changes weekly (It will always be the prior sunday in YYYYMMDD format.

DoCmd.OutputTo acOutputTable, "tbl Export Current Charges", acFormatCSV, "C:\Siemens\Xport_HistoryData\"+varDateFolder+"\Group1\MY_CHARGES.CSV"
0
Comment
Question by:epicazo
  • 3
  • 2
5 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 33736624
before you can do this using codes, you have to create an export specification first...


to create an export spec

1.right click on the table
2.select export > Text file
   click on Browse and locate the destination folder
3. (you can accept the proposed name or change it)
click Save, then click OK
4. In the export text wizard select the type (Delim / Fixed) width
5. Follow the wizard, before clicking on Finish
     5a .Click Advanced
6. In the Export Specification dialog box Field Information List, correct any descrepancies

7. click save as, give the specification a name <-- this is the specification name that you will use in the command line below


DoCmd.TransferText acExportDelim, "ExportSpecName", "TableName", "C:\myCsv.csv", True


0
 

Author Closing Comment

by:epicazo
ID: 33847737
sorry for the delay  --   thanks!
0
 

Author Comment

by:epicazo
ID: 33970978
Capricorn,

I gave you the points without testing.    I am now trying to implement and I get the following error:

The export file does not exist....

DoCmd.TransferText acExportDelim, "Export_CHP_ToRadBillingSFTP", "X_RadBilling", "F:\RadAdvocate\RAD_Billing_CHPYYYYMMDD.CSV", True
0
 

Author Comment

by:epicazo
ID: 33970983
Here is the error....

RUN-TIME ERROR '3625'
"THE TEXT FILE SPECIFICATION 'EXPORT_CHP_TORADBILLINGSFTP' DOES NOT EXIST...."
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 33971033
so, the error message says it don't exists.. did you create any export specification?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now