Solved

Ms Access script to export csv file

Posted on 2011-02-26
3
491 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
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 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now