Hello All,
I have an Access report that has a few forms added. Those forms have queries tied to them. When I run the report, I want to add criteria to the form or query that the form is using. Is this possible to do?
Hello All,
I have an Access report that has a few forms added. Those forms have queries tied to them. When I run the report, I want to add criteria to the form or query that the form is using. Is this possible to do?
you added a form to a report? why? Why wouldn't you create a subreport for your main report? If you did it this way then you could do something like select/enter your criteria on a form and use that to drive the report.
I think I may of misspoke. I have multiple subform/subreport on my main report.
If you are running your report via a button click from a form you can, on that form, add your selection criteria (text boxes or combo boxes to select items) then use it in the queries driving your report using the syntax:
[forms]![FORMNAME]![CRITERIAFIELDNAME]
if you just want your user to type something in (text search)
you can use criteria like
like * & [Enter the Last Name] & *
So you mean something like this in the vba code?
DoCmd.OpenReport "FWReport", acViewReport, , [Forms]![frmG3Comp]![testName] = "test"
No, that looks like you're trying to apply a filter, that might work for the main report but I doubt it for a subreport (never used filters on reports myself) it's more about restricting your data at the query level, as I said it would be in the CRITERIA (in your query) driving the report.