How do I filter a subform based on a chosen record in a different subform?
Posted on 2014-11-21
I have two subforms on a main form, "subfrm_Contacts" and "subfrm_Categories". Both of them are in datasheet view. "subfrm_Contacts" has as its record source a table, "tbl_Contacts", that contains, among other fields, an integer field called "IdCategory". "subfrm_Categories" has as its record source a table, "tbl_Categories," with two fields:" IdCategory", an autonumber field, and "CategoryName", a text field. "subfrm_Categories" only shows the text field which is a list of category names.
I would like to create an event where when I click on a category name in the "subfrm_Categories", "subfrm_Contacts" gets filtered to show only the records where tbl_Contacts.IdCategory = tbl_Categories.IdCategory. What is the best way to do this?