how to save data to csv directly from form???

DeanRowe

Registered User.
Local time
Today, 05:42
Joined
Jan 26, 2007
Messages
142
Hi,

When I’m using one of my forms, I need to be able to take the details that are being displayed on the form and save them to a csv file, such as temp.csv, using a command button on the form.

Does anyone know if this is possible in Access?

There are 23 fields on my [Orders] form, but I need to select the [Name],[Address],[Postcode] and [Sale Value] fields and save them to a .csv file

Any help, advice or tutorials would be greatly appreciated.

Thank you
 
I believe you're going to have to save them to a table first, even if it's only a temporary table.
 
My code to do this looks something like:
Code:
Dim MYPATH As String

MYPATH = CurrentProject.Path & "\SubFolderNameHere\" & "FileNameHere.txt"
    
DoCmd.TransferText acExportDelim, "ExportSpecificationNameHere", "QueryNameHere", MYPATH, True

However, this is for a tab delimited file rather than csv. You would also need to modify the path code to direct the csv to be saved where you want and with the name you want.

You may find the follwoing link helpful if you run into issues.
http://www.access-programmers.co.uk/forums/showthread.php?t=120454&highlight=text+export+tips
 

Users who are viewing this thread

Back
Top Bottom