Hoping someone can help. I currently have an access database for which I have created some reports against. I want to output the report also to an excel file. I am able to do this with no problem using Visual Basic ACCESS DoCmd.OutputTo acOutputReport command (see below). This code is stored in a VB Module. The only thing I can't figure out is how to append the asofdate field to the file name.
The asofdate field is currently on every record of my Sales access table and will always be the same for all records each day. How can I append the asofdate field to the filename when the command below is executed to save the report into an excel file?
This is my current code:
DoCmd.OutputTo acOutputReport, "Report 01 - TodaysSales", acFormatXLS, "c:\TodaysSales.xls", False
Current Output is --> Report 01 - TodaysSales.xls
Would like outfile to be this instead -->Report 01 - TodaysSales as of mm/dd/yy.xls
** where mm/dd/yy is the value from the asof_date field in the access table
The asofdate field is currently on every record of my Sales access table and will always be the same for all records each day. How can I append the asofdate field to the filename when the command below is executed to save the report into an excel file?
This is my current code:
DoCmd.OutputTo acOutputReport, "Report 01 - TodaysSales", acFormatXLS, "c:\TodaysSales.xls", False
Current Output is --> Report 01 - TodaysSales.xls
Would like outfile to be this instead -->Report 01 - TodaysSales as of mm/dd/yy.xls
** where mm/dd/yy is the value from the asof_date field in the access table