I currently have a form that contains a combobox with all the employee names. The combo box calls to a table that contains all of the employee records and generates a report based on the selected employee
I have two buttons, export individual report which is done by selecting an employee from the combo box and once the button is clicked exports the report to PDF to the path written
The second button exports all reports as individual reports to the path written (since there are hundreds of employees it would take too much time to export each individually). The PDF is saved by lastname_firstn ame (column2 and column 1) of the combo box.
Now the second button labels the PDFs correctly as it loops through the combo box, but each time the report is opened the code does not register which employee is being selected and does not update the report with the correct employee records. All of the reports are saved as blanks.
I added the code below, can someone please help figure out a way for when the Report opens it recognizes which employee it is on in the combobox and updates before opening!
Thank you
I have two buttons, export individual report which is done by selecting an employee from the combo box and once the button is clicked exports the report to PDF to the path written
The second button exports all reports as individual reports to the path written (since there are hundreds of employees it would take too much time to export each individually). The PDF is saved by lastname_firstn ame (column2 and column 1) of the combo box.
Now the second button labels the PDFs correctly as it loops through the combo box, but each time the report is opened the code does not register which employee is being selected and does not update the report with the correct employee records. All of the reports are saved as blanks.
I added the code below, can someone please help figure out a way for when the Report opens it recognizes which employee it is on in the combobox and updates before opening!
Thank you
Code:
Private Sub cmdExportAllToPDF_Click() Dim intCount As Integer Dim cmbCount As Integer For intCount = 0 To cmbReportEmployee.ListCount - 1 DoCmd.OpenReport "Letter Report", acViewPreview, , , acWindowNormal DoCmd.OutputTo acOutputReport, "Letter Report", "PDFFormat(*.pdf)", "C:\Users\username\Documents\Stock Letter Reports\" + Forms!ReportOpener!cmbReportEmployee.Column(1, intCount) & "_" & Forms!ReportOpener!cmbReportEmployee.Column(2, intCount) & ".pdf", False, "", , acExportQualityPrint DoCmd.Close acReport, "Letter Report", acSaveNo Next End Sub
Comment