Solved

How to Programatically export comma delimted to CSV

Posted on 2010-09-22
5
1,122 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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 …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

947 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

16 Experts available now in Live!

Get 1:1 Help Now