Export to Excel

kobekaren

Registered User.
Local time
Today, 18:58
Joined
Jun 26, 2008
Messages
16
hi, can anyone tell me how to deal with the following problem?

there is a select query e.g. Query1 whixh contain the data that i want to export to Excel.

i try to use OutputTo and it works.

the excel file is served as a report. however, the column names in the exxcel file is programmer-friendly e.g. add , staffName. those column names are not user-friendly for the readers.

so, can i change the column names during exporting the the query by using VBA???
 
Change the column names in the query. Go into the SQL view and then use "as" to rename the column

Code:
SELECT field1 as Bob
From table

The above would rename the field called "field1" to "bob"
 
O...thank you very much for your help , it works !!
 
hi, can anyone tell me how to deal with the following problem?

there is a select query e.g. Query1 whixh contain the data that i want to export to Excel.

i try to use OutputTo and it works.

the excel file is served as a report. however, the column names in the exxcel file is programmer-friendly e.g. add , staffName. those column names are not user-friendly for the readers.

so, can i change the column names during exporting the the query by using VBA???

or if you don't feel confident changing SQL then you can add the new field name in the design view ending the new name with a ":"

e.g. field1 becomes Bob: [field1]

the [] are there to stop Access putting "'s round text..also if you switch to SQL view you will see the "AS Bob" is added for you.

i do find this method easier if there are a number of columns to change and i use spaces between the new names. but pls it is more what you feel happier using..
 

Users who are viewing this thread

Back
Top Bottom