I have made a new query using an existing parameter query that is linked/joined to a table that will filter the line items from the list of activities. How can I pass the parameter through VBA to parameters of related parameter query as there are no parameters defined on this query and I get 'Error 3061: Too few parameters. Expected #' error for not assigning missing parameters.
I can get the parameters to work on the main parameter query itself but not on this new query where I am using it to filter out the table.
I have tried passing parameters as I would to the original query but still get the same error.
Set boqQD = CurrentDb.QueryDefs("qryCvlExportRevRelatedBOQ")
boqQD.Parameters.Refresh
boqQD.Parameters("paramYear").Value = Me.cmbSearchYear
Set rsBOQ = boqQD.OpenRecordset
Your method is correct. You can list the parameters like this:
Dim P As DAO.Parameter
Set boqQD = CurrentDb.QueryDefs("qryCvlExportRevRelatedBOQ")
For Each P In boqQD.Parameters
Debug.Print P.Name, P.Type
Next
boqQD.Close