Save Report to PDF file and set filename to value on continuous form where check box = true
Posted on 2015-01-03
The following code works but is setting the file name to the first record showing on the continuous form. There is a checkbox "SelectInvoice" for each record showing on the form and I am trying to get it to set the filename to the record where the checkbox is True.
Private Sub cmdSaveToPDF_Click()
Dim FileName As String
Dim FilePath As String
FileName = Me.Company & " " & "Invoice " & Me.InvoiceNumber
FilePath = "C:\Users\John\Documents\Invoices\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptInvoice", acFormatPDF, FilePath
MsgBox "Invoice PDF has been saved.", vbInformation, "Save Confirmed"
Do I need to use an SQL statement to refer to the underling table where the value of checkbox is true?