Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ms Access script to export csv file

Posted on 2011-02-26
3
Medium Priority
?
539 Views
Last Modified: 2012-05-11
Hi,

I have an MS Access database and would like to be able to run a script that automatically selects records from my contacts table and exports them to a csv file. is it possible to automate this? Ideally in versions 2003 & 2007

Regards
Leigh
0
Comment
Question by:Lmillard
[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 Comments
 

Expert Comment

by:plshrk
ID: 34987839
Yes this is possible, would you provide some additional details, please.
0
 
LVL 2

Accepted Solution

by:
jo_m earned 2000 total points
ID: 34987850
hello

if  you make a query tha will perform the selection you require on your contact table

 Then with a bttn on a form    using the  'on click'  event copy the line below into the code window

Docmd.TransferText acExportDelim" ,"queryName"," C;/ExportedContacts.csv"


Can  you can specify what the criteria for your selection is    this would help if you need further assistance

t

 jo
0
 
LVL 4

Expert Comment

by:tabish
ID: 34987962
Write a Macro choosing Action "TransferText". Or you can write VBA if you want more control 0n the code in a module like

sub exportdata()
DoCmd.TransferText TransferType:=acExportDelim, TableName:="YourQuery", FileName:="c:\YourFile.csv"
end sub

and call that exportdata function in a Macro.

Schedule the task (Macro) in the windows scheduler.
 
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

715 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