OutputTo

  • Thread starter Thread starter bkusiek
  • Start date Start date
B

bkusiek

Guest
OutputTo

I have a button on a form that when pressed exports a report as a .snp file using the following code:

Private Sub Save_As_Click()

On Error GoTo Err_Report_Activate

DoCmd.OutputTo acOutputReport, "R_Summary_Report", "SnapshotFormat(*.snp)", , -1

Err_Report_Activate:
Resume Next

End Sub

I have intentionally left the file path blank so that the user can choose what to call the report and where to save it. However, when the "Save As" dialog box is opened the name of the report (R_Summary_Report) appears as the default name. I would like a different default name that is not the name of the report in the database. For example, I would like the name "Summary 19-Oct-2003" to appear instead of "R_Summary_Report" where 19-Oct-2003 is the date the report is saved. Does anybody know if this is possible to do?
 
I don't know if this would work, but how about:

Dim txtReport as String
txtReport = "Summary " & Date
DoCmd.OutputTo acOutputReport, ' " & txtReport & " ' ,"SnapshotFormat(*.snp)", , -1
 
Thanks for the suggestion but what you are suggesting won't work. The position of "R_Summary_Report" in the OutputTo command identifies which report to export not the name of the report in the Save As dialog box that appears after the code is executed. If I change "R_Summary_Report" to what you are suggesting, Access will not know what report to export.
 

Users who are viewing this thread

Back
Top Bottom