I agree & don't agree with Greg. Yes, normally the main form, by virtue of its Parent/Child relationship, "filters" the subform, usually on its foreign key.
But what about, when invariably, you get records, in this case products, that occur in more than one Parent record, (regardless of which form, is parent). Is it possible to "reverse" the filter (so to speak), for whatever reason?
Normally a viable suggestion Steve, but the subform does not contain any corresponding fields as the main form. The only commonality would be the linked fields, primary key & foreign key, I suppose.
If you filter the subform, hypothetically, with a combobox selection, due to the link, would the main form be filterd accordingly? I doubt it.(I'm thinking out loud here)
Here's my thought, pick a product, create recordset with that product only. Loop through, populating an array with all the foreign keys, that belong to that product. With array, create SQL, that will be appended to recordsource of main form.
All orders with that product (and a few others, I assume, if more than 1 product for an order), will be viewed.
If I've understood the post correctly, I think this may be an option.
Either way, good luck GregoryHu, it sounds like an interesting challenge.
|