Open Report from a form that has several filter buttons
Posted on 2004-11-04
to reflect filtered records of chosen filter.
This is a hard one, so if anyone can help with the code maybe my head would stop thumping.
I have a main Form called Diary. In it a Subform called MiniList. On the Main form I have 4 combo filters and 4 buttons that activate param queries. It all works lovely.
I have a Preview Report button on the main form which shows up my 2000 records in a report called FiltersReport. But when I apply any of my filters, the preview report just chucks up my message.
My code on my preview button is:
If Me![MiniList].Form.Filter = "" Then
Msgbox 'Apply a filter to the form first"
DoCmd.OpenReport "FiltersReport", A_PREVIEW, , Me![MiniList].Form.Filter
The Report Filter is set to on.
I can apply a specific filter from any of my eight but I don't want to do that otherwise i would have to create 8 preview report buttons. I want one button to display filtered records from any filter that was applied to my subform by the user and at any time. Is this possible?