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
Solved

How to Programatically export comma delimted to CSV

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Spell checker for VBA 4 29
Adding new field to an existing database in access 3 25
set focus to tabbed sub form 10 39
Calculated field not displaying as currency on form 4 20
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

856 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