I want to be able to filter a main form based on a text search of subform records. I have a fairly simple database for keeping track of the contents of offsite file storage boxes for a law firm, with two linked tables: the master table contains details about the box, and the child table contains a list of box contents, much like an invoice form. Pretty simple stuff. The database might ultimately track 10,000 or so boxes in storage.
The key form to this application is a standard form/subform. What I need is to be able to filter based on text in the box contents: Which boxes contain at least one reference to “Charlotte”? I’d like to be able to use standard “right-click” filtering commands – filter on/excluding selection and avoid using a separate search form.
The rub is obvious — when you set a filter on the subform, it applies to the subform, not the main form. In pseudo-code, what I think needs to happen is to intercept the OnApplyFilter event (which I can do), and cancel it to allow all of the line item detail to display. Then pass the filter condition to the main form, using an inner join to limit the display of box records.
It seems to me this should be a frequent problem (searching invoice detail, order detail, etc.), but I didn’t see any mention of it when I searched. It’s a shared application, so that seems to rule out a Flag field. Filtering doesn’t seem appropriate, and changing the recordsource doesn’t seem to permit a join (it gets stripped out).
I’m stumped. Anyone got a solution? I suspect it’s something obvious that I just don’t see.