I currently use a macro to run: first a make table query, then a filtered query, then it outputs to an excel file. I'd like Access to give this spreadsheet a unique name without any prompting by the user. I currently have it name the spreadsheet, "needtoorder.xls". I'd like Access to name it "needtoorder61902.xls" (today's date).
Here's the code I'm using:
What is available to make Access generate a new file name?
I'm just a beginner with code, and I truly appreciate all the advice that's given on this forum.
Thanks in advance,
Rhonda
Here's the code I'm using:
Code:
'------------------------------------------------------------
' Daily_Need_to_Order_Report_to_John_H
'
'------------------------------------------------------------
Function Daily_Need_to_Order_Report_to_John_H()
On Error GoTo Daily_Need_to_Order_Report_to_John_H_Err
DoCmd.SetWarnings False
DoCmd.OpenQuery "7New Work Order Info", acNormal, acEdit
DoCmd.SetWarnings False
DoCmd.OutputTo acQuery, "Need To Order-Filtered", "MicrosoftExcel(*.xls)", "p:\JohnH\needtoorder.xls", False, ""
DoCmd.SetWarnings False
Daily_Need_to_Order_Report_to_John_H_Exit:
Exit Function
Daily_Need_to_Order_Report_to_John_H_Err:
MsgBox Error$
Resume Daily_Need_to_Order_Report_to_John_H_Exit
End Function
What is available to make Access generate a new file name?
I'm just a beginner with code, and I truly appreciate all the advice that's given on this forum.
Thanks in advance,
Rhonda