Exporting fieldname issue

G

Guest

I want to export a query but have the fieldnames in the exported file
different to those in the Access database but I cannot see how to do this.

I have gone into the field properties in the query & changed the caption &
description to the fieldname I want & it is displayed the way I want in the
query but when I export the data & open the file in Excel the filednames have
reverted to the original fieldnames in the Access database

TIA
 
V

Van T. Dinh

Have you tried using Aliases in your Query like:

SELECT [TableFieldName1] As [ExportFieldName1],
[TableFieldName2] As [ExportFieldName2],
....
FROM [YourTable]
....

then use this Query as the Source for your export.
 
G

Guest

I right mouse clicked the Field list in the query & went to Propeties I tried
entering it into the Alias but got a:

"SELECT [Account_Number] As [AccountNum] FROM [Funding] is not a valid name"
error message. Make sure it does not include invalid characters or
punctuation that is too long"

Is this the correct place to enter this?

I was trialling by renaming 1 field only at this stage. TIA
--
Tony


Van T. Dinh said:
Have you tried using Aliases in your Query like:

SELECT [TableFieldName1] As [ExportFieldName1],
[TableFieldName2] As [ExportFieldName2],
....
FROM [YourTable]
....

then use this Query as the Source for your export.

--
HTH
Van T. Dinh
MVP (Access)



TonyL said:
I want to export a query but have the fieldnames in the exported file
different to those in the Access database but I cannot see how to do this.

I have gone into the field properties in the query & changed the caption &
description to the fieldname I want & it is displayed the way I want in
the
query but when I export the data & open the file in Excel the filednames
have
reverted to the original fieldnames in the Access database

TIA
 
J

Joe Fallon

In the grid an alias looks like this:

MyNewName: theRealFieldName
================================
In SQL view it looks like Van describes:

theRealFieldName As MyNewName
--
Joe Fallon




TonyL said:
I right mouse clicked the Field list in the query & went to Propeties I
tried
entering it into the Alias but got a:

"SELECT [Account_Number] As [AccountNum] FROM [Funding] is not a valid
name"
error message. Make sure it does not include invalid characters or
punctuation that is too long"

Is this the correct place to enter this?

I was trialling by renaming 1 field only at this stage. TIA
--
Tony


Van T. Dinh said:
Have you tried using Aliases in your Query like:

SELECT [TableFieldName1] As [ExportFieldName1],
[TableFieldName2] As [ExportFieldName2],
....
FROM [YourTable]
....

then use this Query as the Source for your export.

--
HTH
Van T. Dinh
MVP (Access)



TonyL said:
I want to export a query but have the fieldnames in the exported file
different to those in the Access database but I cannot see how to do
this.

I have gone into the field properties in the query & changed the
caption &
description to the fieldname I want & it is displayed the way I want in
the
query but when I export the data & open the file in Excel the
filednames
have
reverted to the original fieldnames in the Access database

TIA
 
G

Guest

Now I understand & did it in the SQL view & it works. Thank you both for
your help.
--
Tony


Joe Fallon said:
In the grid an alias looks like this:

MyNewName: theRealFieldName
================================
In SQL view it looks like Van describes:

theRealFieldName As MyNewName
--
Joe Fallon




TonyL said:
I right mouse clicked the Field list in the query & went to Propeties I
tried
entering it into the Alias but got a:

"SELECT [Account_Number] As [AccountNum] FROM [Funding] is not a valid
name"
error message. Make sure it does not include invalid characters or
punctuation that is too long"

Is this the correct place to enter this?

I was trialling by renaming 1 field only at this stage. TIA
--
Tony


Van T. Dinh said:
Have you tried using Aliases in your Query like:

SELECT [TableFieldName1] As [ExportFieldName1],
[TableFieldName2] As [ExportFieldName2],
....
FROM [YourTable]
....

then use this Query as the Source for your export.

--
HTH
Van T. Dinh
MVP (Access)



I want to export a query but have the fieldnames in the exported file
different to those in the Access database but I cannot see how to do
this.

I have gone into the field properties in the query & changed the
caption &
description to the fieldname I want & it is displayed the way I want in
the
query but when I export the data & open the file in Excel the
filednames
have
reverted to the original fieldnames in the Access database

TIA
 

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