Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OutputTo - I want to change the Field Names 1

Status
Not open for further replies.

LiLgUrL

Technical User
Feb 9, 2003
59
CA
I know for sure this is just a simple problem - but i just can't figure it out on how to solve it. I am using a query to import a result query to xls but what i want to do now is that - i want to change the field names of the table.
My query consist of some expressions so the Fielname consist of Expr1, Expr2 etc... i want to change it to some descriptive field name.

Here's my code:
DoCmd.OutputTo acOutputQuery, "Sample", "MicrosoftExcel(*.xls)", "\Sample\" & "_" & strDate & ".xls"

do i have to add something? Please advice

 
Hi 4bUsTeD,

The names are defined in your Query. In Query Design, the "Field" Field will look something like this ..

[purple] [red]Expr1:[/red] IIF([Field1]="Fred",...[/purple]

.. and the corresponding SQL will be ..

[purple] SELECT ... IIF([Field1]="Fred",... [red]AS Expr1[/red] ...[/purple]

The names Expr1, Expr2, etc. are generated by Access if you don't supply your own. All you should need to do is replace the generated names with ones of your own choosing.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
thanks tony i didn;t know that - hope to hear from you again i still have a lot of questions ... mmmmmwhagz!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top