Fred Webb
asked on
Apprnding a date to Access OutputTo statement
I have a form with a list box (lstReports) to select reports for various outputs email as PDF or Excel, print, View, and Save to PDF. All work fine except on the save to PDF, I want to append the current date to the end of the filename but it is failing with “the OutPutTo action was canceled” error. If I exclude the append operation it save fine with the report name.
Private Sub btnSavePDF_Click()
On Error GoTo btnSavePDF_Click_Err
Dim stDocName2 As String
stDocName2 = Me.lstReports
DoCmd.OutputTo acOutputReport, stDocName2, acFormatPDF, stDocName2 & Format(Date, mmddyyyy), True
btnSavePDF_Click_Exit:
Exit Sub
btnSavePDF_Click_Err:
MsgBox Error$
Resume btnSavePDF_Click_Exit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER