I can't name file from query DoCmd.OutputTo acReport

jconverse

New member
Local time
Yesterday, 21:24
Joined
Apr 28, 2009
Messages
4
I need help...I want to name a file from the results of a query in Access 2003

I have

Private Sub Command0_Click()
DoCmd.OutputTo acReport, "REPT_MAKE1", "MicrosoftExcelBiff8(*.xls)", "C:\" & Store# & ".xls", 0
End Sub

I want to get to where I can name XLS from the query results

I have a query that will come back with 1 number and I want that number in naming the file

Example

3111.xls

I know there is a Select in there

the query name is STORE_NUM

Thanks so much
 
Last edited:
You'd have to use a DLookup() to get the value from the query. Unless the query is also the source of the form this is on, it would have no knowledge of that value.
 

Users who are viewing this thread

Back
Top Bottom