From: ericsmith1172 via AccessMonster.com on
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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

From: PieterLinden via AccessMonster.com on
ericsmith1172 wrote:
>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...

--
Message posted via http://www.accessmonster.com