fraser_lindsay
Access wannabe
- Local time
- Today, 16:53
- Joined
- Sep 7, 2005
- Messages
- 218
Hi,
I have created a command button to open a report of a sepcific record, save/export as PDF and then close the report. This forum and Google were a huge help, once again.
I'm stuck with the last part though. I would like to name the exported file using a unique reference in one of my form fields.
At the moment it exports as the name of the report, even though it is filtered. Here is my code from my command button on-click event:
What code can I use to specify the field "JSARef" in the file name?
Thanks
I have created a command button to open a report of a sepcific record, save/export as PDF and then close the report. This forum and Google were a huge help, once again.
I'm stuck with the last part though. I would like to name the exported file using a unique reference in one of my form fields.
At the moment it exports as the name of the report, even though it is filtered. Here is my code from my command button on-click event:
Code:
Private Sub SavePDF_Click()
'This code will open the named report and match the named fields below to open the report on that specific record
Dim sReportName As String
Dim sFilter As String
sReportName = "rptSpecificJSA"
sFilter = "JSARef = " & Me.cboJSARef
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport sReportName, acPreview, , sFilter
'This will export the filtered, report in preview mode as a PDF file with the name in quotations.
DoCmd.OutputTo acOutputReport, "rptSpecificJSA", acFormatPDF, strAttachPath & strAttachPath2, False, , , acExportQualityScreen
DoCmd.Close acReport, "rptSpecificJSA"
End Sub
What code can I use to specify the field "JSARef" in the file name?
Thanks