Create CSV File

martinainscough

Registered User.
Local time
Today, 22:48
Joined
Apr 8, 2004
Messages
18
Hi All

I am trying to create a CSV file from a query and am not sure how to go about it. I have the query complete but do not know how to format it and save it as csv. In addition in need to add a header for the file on line 1 which contains the file information for the company that i need to send it off to.

If anyone has any ideas on how to go about this it would be much appreciated

Many Thanks

Martin
 
Use the TransferText method.

i.e.

Code:
Const TableName As String = "MyTable"
Const FilePath As String = "C:\MyFile.txt"

DoCmd.TransferText acExportDelim, , TableName, FilePath, True
 
Thanks I'll try that

would that enable me to add a header to the file that contains the information for the data that the comapany i send it to needs

Thanks

Martin
 
CSV format

Hi All

I have created a table that i am exporting to a csv file. The only thing is that the text entries contains the quote (") marks at either end of the string. Is there any way to get rid of these so for example instead of adding "T" it adds just T

Any help would be greatly appreciated

Thanks

Martin
 
go to Edit -> Find & Replace, in the Find What field put " and leave the Replace With field empty and click on the Replace All button.
 
thanks i would do this but this is a program for somebody else.

Is there anyway that the csv could be exported without these quote marks or a piece of VB code that could be used that would delete them automatically.

Thanks

Martin
 
Are you sure you want to remove the quotes? Text fields surrounded by quotes is the standard for comma delimited files.

You can modify this when you do the export if you set up an export spec. You must export the file manually once so you can get to the advanced settings. Choose the no quotes option and save the spec. You can then reference this saved export spec from a TransferText Method or Action so you can automate the task.
 
No. Files containing header records (except for column headings which are controlled by the last argument of the TransferText) are non-standard and you would need to create them with VBA code. You can't use any built in feature.
 
When you create a new thread because you didn't like the answer that you got on a previous thread in the same section of the forum with the same question, you insult those of us who try to offer help.

I'm sorry you find this problem to be beyond your means. It doesn't invalidate our answer. But your action tells us you don't want to learn how to do it right when we tell you how to do it.
 
CSV Posts

Hi Doc

I Apologise as there was no offence intended by submitting another post. I am new to the forum and am not sure how to go about getting answers to new questions. The 1st question I asked was to find out how to create a header on a csv. Once I had done this then I found that the csv file contained quotation marks. I did then ask this question in the same post.

I did then post a new question as I thought that this was different to the original one I asked. I suppose that this wasn't good practice by the forum. The answer you gave to me was actually the second post and then somebody answered the first post again after your answer. That's why I think that it has appeared above the 2nd post.

As a whole there was no offence intended to you and your answer is very much respected. Your help is much appreciated and has made me look at the problem from a different angle. I think that the forum is great and has already helped me out considerably.

Many Thanks

Martin
 

Users who are viewing this thread

Back
Top Bottom