I'm trying to export an Access report to a specific location with the file saving with a specific name that is linked to a form in the Access database. I have the below code. The problem is with the strSubject line. I'm not sure how to get the information from the form (the form is DateRanges and the filed in the form is text2). With that form, the code works. Below is the code.
Thanks
Rich (BB code):
Rich (BB code):
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Private Sub Command20_Click()
Dim stReport As String
Dim stSubject As String
Dim FileNamePDF As String
strSubject = "Brooklyn" & [Forms]![dateranges]![text2]
strReport = "Store251001"
DoCmd.OpenReport strReport, acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, "R:\Arcguve\" & strSubject & ".pdf"
End Sub
[/FONT]
Thanks