Send form's filtered data to a report

Magster

Registered User.
Local time
Today, 09:55
Joined
Jul 30, 2008
Messages
115
Hi all,

I have a continuous form where my users filter the data by any combination of fields and they can print the form which lists all of the rows. This works OK, but what I’d really like to do is capture the recordset clone and use the data in a report.

I tried to set the recordsource of the report to the form’s recordset clone in VBA but that didn’t work. I do have stored queries for the starting point of the form, so maybe there is a way to capture the filter that the user built and use the stored query and the filter to run a report. Or even store the recordset into a temp table and run the report from there, but that seems like a wasted step…

I’ll stop speculating and see if anyone has an answer.

Thanks!
 
As long as the recordset of the report has the same fields (same names) in its record source, you should be able to do this:

DoCmd.OpenReport "Report Name Here", acViewPreview, , Me.Filter
 
Hi SOS,

Thanks that is just what I needed. In addition, on my form the user selects one of three types of records to look at - open, closed, or all.

So when they click the button for the report, I pass an open argrument designating this to the report and on the report's open event, I check the open args and load the corresponding query and the filter is set as you suggested when the report is called.

Very slick - and thank you very much!
 

Users who are viewing this thread

Back
Top Bottom