Hi all,
First time poster and beginner here.
I'm having an issue with a some VBA I'm trying to piece together to export individual reports to PDF by employee ID. The report is based on a query (qryMnthlyCommSumm) and the issue I'm having is passing the criteria to the query. There are 2 criteria I'm trying to pass to the report query: "Monthly" and a combo box value from a subform but I'm getting Error 3265 "Item not found in this collection."
This is what I have so far thanks to some searching:
Thanks in advance!
First time poster and beginner here.
I'm having an issue with a some VBA I'm trying to piece together to export individual reports to PDF by employee ID. The report is based on a query (qryMnthlyCommSumm) and the issue I'm having is passing the criteria to the query. There are 2 criteria I'm trying to pass to the report query: "Monthly" and a combo box value from a subform but I'm getting Error 3265 "Item not found in this collection."
This is what I have so far thanks to some searching:
Code:
Private Sub Command22_Click()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
'Get the parameter query
Set qdf = dbs.QueryDefs("qryMnthlyCommSumm")
qdf.Parameters("[Pmt Occ]").Value = "Monthly"
qdf.Parameters("[End Date]").Value = "[Forms]![fmnuMain]![NavigationSubform].[Form]![RptMonth]"
Set rst = qdf.OpenRecordset()
Do While Not rst.EOF
strRptFilter = "[EE No] = '" & rst![EE No] & "'"
DoCmd.OutputTo acOutputReport, "rptMnthlyCommStmt", acFormatPDF, "C:\Temp" & "\" & rst![LN] & " - " & rst![EE No] & ".pdf"
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub