gojets1721
Registered User.
- Local time
- Today, 06:29
- Joined
- Jun 11, 2019
- Messages
- 430
I've got the following code that exports a report to a pre-designated folder. It works great so I want to use it for a different project. However, the only change is that the user needs to be able to select their own folder to save. It can't be pre-designated. Since you all helped me with this code, I thought it was easiest to just come back for this small change.
Code:
Private Sub cmd_exportPDF_Click()
Dim reportName As String
Dim criteria As String
Dim strfolder As String
Dim strfilename As String
reportName = "CompletedForm"
criteria = "[ComplaintNumber]= " & [Forms]![frmDetails]![ComplaintNumber]
strfolder = "F:\documents\"
strfilename = Me.CustomerLastName & ", " & Me.CustomerFirstName & " " & Format(Me.DateOpened, "m.d.yyyy") & ".pdf"
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, strfolder & strfilename
DoCmd.Close acReport, reportName, acSaveNo
End Sub