I have been trying to figure this out for hours; hopefully someone can point me in the right direction.
I have attached a sample of database I am working on to track contracts. Each contract can be associated with one or more "contract allocations" which specific the physical locations where the particular contract will impact. From the main form (“ContractsActive”), if you click a contract ID, the contract detail form will open and you can see the locations for that particular contract at the bottom of the form.
Here is my question: on the “ContractsActive” form I have added a combo box in the header area that is tied to the values in the Locations table. Currently, selecting a value from this combo box does nothing, but I would like to use it as a filter to limit the values in the datasheet below to only those contracts that are associated with the location selected. For example, if you select “UT Location” from the combo box, the datasheet below should only show contract IDs 1, 3, and 5, as they are the only contracts tied to that location. Then if you clear the combo box, the datasheet will show one record for each contract as it does now.
I almost got this working by adding the ContractAllocations table to the “ContractsActive” query which is the source for the form’s datasheet, then creating a macro on the After Update event of the combo box which set a filter on the LocationID field that I added to the query. The problem with that was that by adding the ContractAllocations table to the ContractsActive query, I get more than one record for each Contract ID when there are multiple locations associated with a contract. This is not a problem when a location filter is set, but I also want to be able to clear that filter on the ContractsActive form and only see one record per Contract ID, the way it looks now.
Hopefully that all makes sense. Any help would be greatly appreciated.
Thanks!
Aaron