jstacy00
jstacy00

Reputation: 85

Access is replacing # with . when exporting to a csv

I have a small access program that is exporting data to a csv. The csv needs to have field headers that include #'s. However when I export using VBA:

DoCmd.TransferText acExportDelim, "ThisExport", "GeneralQuery", "C:\ThisFile\data.csv", True

It changes the #'s into .'s:

enter image description here

enter image description here

Upvotes: 0

Views: 143

Answers (1)

June7
June7

Reputation: 21370

One approach uses a UNION query:

SELECT 0 AS Cat, "Email #1" AS A, "Email #2" AS B, "Email #3" AS C FROM Table1
UNION SELECT 1, [Email #1], [Email #2], [Email #3] FROM Table1;

Set TransferText HasFieldNames argument to False and export query.

However, if your import app cannot deal with presence of Cat field, use textfile read/write methods. This is a fairly common topic. Export data with TransferText then use read/write methods to modify.

Upvotes: 1

Related Questions