View Full Version : Printing your filter criteria in the report


cortevil
07-14-2006, 02:12 PM
Hi all,

Had a look through the archives and didn't find anything like this.

I have a form set up so the user can either select the report with all cases or the report with a date filter. Both buttons point to macros that use the OpenReport command, but the second macro also has a filter specified (for the date range) in the OpenReport command. Everything looks great, the report is coming up with the correct numbers under either scenario.

Here's the thing I can't figure out...

I would like the report that has the date filter applied to also print that date range on the report, but I can't figure out how to do that without the report thinking I'm applying the filter directly to it at all times. Obviously, this only needs to occur when the filter is applied.

Any thoughts?

Thanks much!
Lori

llkhoutx
07-15-2006, 08:08 AM
On the report OnOpen event store the filter in a hidden form textbox, them reference that form textbox in the report to display the filter.

Isolating the filter in ther report recordsource may or may not be simple depending on the recordsource, that is, considering wherether the recordsource uses a WHERE, HAVING, GROUP BY, etc. However, you can dot it. If it uses the filter property, it wouold of course be simple.

cortevil
07-17-2006, 05:40 AM
Tried the hidden control thing. The only property I could find on the text box report control was 'visible', which when I flipped to 'no' still asked for my start and end date (the control reads "=[start date] & "and" & [end date]). Can't seem to find the 'hide' property that is on the form controls. Maybe I'm missing something?

I suppose I could place the filter in the recordsource, but how would I reference a command button click to apply the filter? IIf(CmdBut2 = ???, "=[start date] & 'and' & [end date]","")?

Thanks!