I am using the DoCmd.TransferText in MS-Access-2010 VBA to export a table to a .csv file. However when I do this the resulting .csv file truncates the information in the table. For example the longitude -85.350223 becomes -85.35. How do I make it where the resulting .csv file is still comma delimited and keeps the full information from the table?
If I need to create an Import/Export specification and reference it in the command line using the SpecificationName feature of DoCmd.TransferText (assuming I have correctly interpreted this feature as a formatting tool) please explain how to do that.
Here is the line I am currently using to export the file to .csv:
DoCmd.TransferText acExportDelim, , "AllMetersAvgRSSI", CurrentProject.Path & "\AllMetersAvgRSSI.csv"
Great code everyone. It works very well and fast. I added one line, to handle the situation where the table name passed in contains a space.
My version of the entire procedure (with that one change):
I recommend you use this function taken from eraserve:
Here's how you use/call it:
And here's the function:
You may also have success by changing the offending fields to text fields, or simply copying them into some temporary text fields before you do the export.
Thanks, @HK1 for posting this code. I made a few modifications:
Note: This can be used to export tables or queries (select or crosstab).
Here's how you call it (assuming double-quotes for the text delimiter):
Here's the function: