DoCmd.TransferText issue

J

JP

I am exporting a csv text file from the results of an access query.
Everything works fine, but the column headings in the text file have illegal
field names in Access. For example Total..Cost Access does not allow me to
have a period in the column name of my query. Is there an easy fix for
this? The file specification for the text file calls for headings with the
period in them. At present, I am creating it without the period, but the
file needs the period to upload properly.

my Code:
DoCmd.TransferText acExportDelim, "", sTable, sFile, True, ""
 
K

Ken Snell MVP

Surround the Total.Cost text with [ ] characters in the query for the alias
name:

SELECT FieldName As [Total.Cost]
FROM TableName;
 
J

JP

I get a message stating there are invalid characters. Is there another
method I can use?


Ken Snell MVP said:
Surround the Total.Cost text with [ ] characters in the query for the
alias name:

SELECT FieldName As [Total.Cost]
FROM TableName;

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



JP said:
I am exporting a csv text file from the results of an access query.
Everything works fine, but the column headings in the text file have
illegal field names in Access. For example Total..Cost Access does not
allow me to have a period in the column name of my query. Is there an
easy fix for this? The file specification for the text file calls for
headings with the period in them. At present, I am creating it without
the period, but the file needs the period to upload properly.

my Code:
DoCmd.TransferText acExportDelim, "", sTable, sFile, True, ""
 
K

Ken Snell MVP

Post the entire SQL statement of the query that you're trying to export.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


JP said:
I get a message stating there are invalid characters. Is there another
method I can use?


Ken Snell MVP said:
Surround the Total.Cost text with [ ] characters in the query for the
alias name:

SELECT FieldName As [Total.Cost]
FROM TableName;

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



JP said:
I am exporting a csv text file from the results of an access query.
Everything works fine, but the column headings in the text file have
illegal field names in Access. For example Total..Cost Access does not
allow me to have a period in the column name of my query. Is there an
easy fix for this? The file specification for the text file calls for
headings with the period in them. At present, I am creating it without
the period, but the file needs the period to upload properly.

my Code:
DoCmd.TransferText acExportDelim, "", sTable, sFile, True, ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top