Solved

Export Access 2010 table to csv with VBA

Posted on 2011-09-16
1
793 Views
Last Modified: 2012-05-12
What's the easiest way in Access 2010 to export a table to a csv file.  I used the following:
    DoCmd.TransferText acExportDelim, , "Std Template RC", "D:\Documents and Settings\204064422\My Documents\GE\Testman Setup Interface\stdTemplate.rc"

But got a message that the table is read only and cannot be exported.  Does this happen when you have the table open on a subform?

Also, if I can get past that problem, will the command above export a .csv or tab delimited?

Thanks.
0
Comment
Question by:janderscu
1 Comment
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 125 total points
ID: 36552085
I see an extra comma after acExportDelim, which means that you feeding a blank to the tablename argument.  Try using named arguments instead, as in this example:

   DoCmd.TransferText transfertype:=acExportDelim, _
      tablename:="tblCustomers", _
      FileName:="D:\Documents\Examples\Export Delimited.csv", _
      hasfieldnames:=True
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)

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

744 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

13 Experts available now in Live!

Get 1:1 Help Now