Export table to .csv without quotes

dcollins

Registered User.
Local time
Today, 11:28
Joined
Nov 24, 2003
Messages
30
I have vba code that writes data to a table and then exports that table. I need it to export without the double quotes around every field but I cannot get it to work. Here is my docmd code:
DoCmd.TransferText acExportDelim, SpecCSVExport, tempTable, ExportFileName
(tempTable and ExportFileName are variables for the tablename and filename as the filename is different each time)

If I go to that table, select export, text file manually, open the specification file (SpecCSVExport), it works fine, but in code it does not, I get this:
"UA","160943","","5170","","","IN000091641","Catering","450.00"

instead of this (from manual export)
UA,160943,,5170,,,IN000091641,Catering,450.00

I have deleted, recreated and renamed the spec file multiple times and cannot see what I am doing wrong. I'm using Access 2007.
Thanks so much,
Diane
 
Last edited:
How inside the export specification have you tried to tell it to not include the quotes?
 
I set the Text Qualifier to "none"
 
Any chance you can upload a copy of the database here with bogus data so we can test it?
 
Here it is. I commented out some of the code because it goes to another database to get data. Go to frmEnterDate and enter June 30, 2011 for start date and end date and click submit and the vba code will export the files. Right now since I have some code commented out the temp file is not deleted after each pass because I wanted to leave some records in there. In other words the data itself in the exported files may not be correct but you can see the quotes in each file created and that is my problem. Thanks.
 

Attachments

Finally figured this out but why this works, I don't know. When I step through code and highlight the spec name, it would show "specification file not found" or something like that. I put the specification name in quotes and it worked. For example:
DoCmd.TransferText acExportDelim, "SpecCSVExport", tempTable, ExportFileName
 
Finally figured this out but why this works, I don't know. When I step through code and highlight the spec name, it would show "specification file not found" or something like that. I put the specification name in quotes and it worked. For example:
DoCmd.TransferText acExportDelim, "SpecCSVExport", tempTable, ExportFileName

Yeah, that is specified in the help file and I didn't ask about it because I had apparently assumed that your spec name was a variable with the name instead of the actual spec name. If you aren't sure what to pass, just put your cursor on the thing like TransferText and hit F1. The help should come up and tell you what it is expecting. That is a good thing to use whenever you aren't sure about something.
 
Ah yes, totally makes sense now. I just completely missed the fact that every other parameter was a variable except that one. A definite slap your forehead "DUH" moment. Thanks for the F1 tip, that will come in handy.
 

Users who are viewing this thread

Back
Top Bottom