I have a query that has a main table and a related table, one to many. I am using the following code to open a report and to pass a query name and record selection criteria.
DoCmd.OpenReport "rptAllDataFields1", acPreview, "qryAllDataFields3a", "[County] = 'Deschutes'"
DoCmd.OpenReport "rptAllDataFields1", acPreview, "qryAllDataFields3a", "[Component] = 'ITS'"
The first syntax works, the criteria, "[County] = 'Deschutes'", is a field in the main table.
The second syntax does not work, the criteria, "[Component] = 'ITS'", is a field in the related table. It gives me an “Enter Parameter Value” pop-up that wants “Component”.
The query works if you put the criteria "ITS" in the Criteria row just not when it is passed with the code.
DoCmd.OpenReport "rptAllDataFields1", acPreview, "qryAllDataFields3a", "[County] = 'Deschutes'"
DoCmd.OpenReport "rptAllDataFields1", acPreview, "qryAllDataFields3a", "[Component] = 'ITS'"
The first syntax works, the criteria, "[County] = 'Deschutes'", is a field in the main table.
The second syntax does not work, the criteria, "[Component] = 'ITS'", is a field in the related table. It gives me an “Enter Parameter Value” pop-up that wants “Component”.
The query works if you put the criteria "ITS" in the Criteria row just not when it is passed with the code.