Solved

How to Programatically export comma delimted to CSV

Posted on 2010-09-22
5
1,133 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 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