I have a form that users could click on the record and open a report in a separate windows and then they could export (by right click the report) the report to excel file format, etc. The code is as following:
DoCmd.OpenReport "rptTemplate", acViewPreview, , fltSQL
DoCmd.OutputTo acOutputReport, "rptTemplate", acFormatXLS, "C:\temp" & Format(Date, "mmddyyyy") & ".xls"
My questions are:
1. If I don't have the first line: DoCmd.OpenReport ... Then the second line could not be exported succesfully. I want to have a batch command that users will get the exported result directly without opening the preview windows. Is it possible?
2. It says the Outputfile parameter in Outputto command is defined as: "A string expression specifying the full path and name of the destination object. To enter the destination at runtime leave this argument blank."
But when I used this command: DoCmd.OutputTo acOutputReport, "rptTemplate", acFormatXLS, ""
I still could enter the destination at runtime. What I need to do is to give the users the ability to enter the destination at runtime and then export the report using the predefined file name (generated by today's date). Is it possible?
Thanks for the help.