• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

Report based on "Filter by form" filtered recordset

I have a access form that has approximately 35 form elements.  The filter by form element, and the Advanced Filter, allows me to reduce the recordset from the full table to a reduced recordset.

I have a report that has the same query as that form.  What I would like to do is untie the query from the report, and tie the report's recordset come from the form.  If the form's filter function is applied, then I want that recordset to be what goes to the report, not the whole recordset.

Can this be done?
Evan Cutler
Evan Cutler
1 Solution
If the report's query is the same as the form's, without changing the report's record source, try the following VBA in a command button click event on the form:

If me.FilterOn = true then
     Docmd.OpenReport "YourReportName", acviewpreview, , Me.Filter
     Docmd.OpenReport "YourReportName", acviewpreview
End if

Open in new window

Evan CutlerAuthor Commented:
That worked perfect.

now, What I need to do is put the Me.Filter value into a field (which I've done), and then transform it to something human readable.  I'll make that another question for more points.

Thanks Much.
Chi Is CurrentCommented:
Well, that's beautiful.  Elegant simplicity!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now