Solved

Export Access 2010 table to csv with VBA

Posted on 2011-09-16
1
807 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
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…

679 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