Adding a Field Name from Table/Query to Excel Export File

  • Thread starter ericsmith1172 via AccessMonster.com
  • Start date
E

ericsmith1172 via AccessMonster.com

What I have is an export file to excel which I am able to do successfully
using an OutputTo macro:
Object Type: Query
Object Name: ZZZ_Executive_Summary
Output Format: Miscrosoft Excel 97-2003 (*.xls)
Output File: "C:\ES\" & Format(Date(),"mm-dd-yyyy") & " Executive Summary.
xls"

What I would like to do is add the branch name into the file name. The field
in the query is simply "Branch"

When I try something like &[Branch]& or (query name/field) >> &ES!Branch& or
&[ES].[Branch]&, etc... no matter what I try, I get an error. I would like
to put this field after the date...EX:
C:\ES\05-20-2010 Hoboken Executive Summary.xls

I am using access 2003 w/SP3
 
P

PieterLinden via AccessMonster.com

ericsmith1172 said:
What I have is an export file to excel which I am able to do successfully
using an OutputTo macro:
Object Type: Query
Object Name: ZZZ_Executive_Summary
Output Format: Miscrosoft Excel 97-2003 (*.xls)
Output File: "C:\ES\" & Format(Date(),"mm-dd-yyyy") & " Executive Summary.
xls"

What I would like to do is add the branch name into the file name. The field
in the query is simply "Branch"

When I try something like &[Branch]& or (query name/field) >> &ES!Branch& or
&[ES].[Branch]&, etc... no matter what I try, I get an error. I would like
to put this field after the date...EX:
C:\ES\05-20-2010 Hoboken Executive Summary.xls

I am using access 2003 w/SP3


I would try using one of the domain functions... DLookup or whatever -
something that returns ONE value. Your problem is that a query is going to
return a SET of records, not a single record. (Big difference!). If you
have to, you can do it in code... but try the DLookup route first...
 

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