Answered: [VBA] Listboxes, Selections, and Requeries
I have a form with a tab control and three listboxes on one of the tabs-- let's call them lbxMain, lbxList1, lbxList2. lbxMain has a list of records from a saved query, lbxList1 and 2 are both lists of metadata based on the selection in lbxMain with built in query data. None have control sources, all have the queries as row sources.
I have vba (see below) at the end of a routine that essentially removes a record from lbxMain by changing a record and requerying the listbox. So update record, reuery lbxMain, record is removed; this requery works just fine!
My problem: When the code moves on to requery lbxList1 and lbxList2, they are still keeping the metadata based on the previous selection, even though am changing the selection in lbxMain. Once I actually click on a new selection in lbxMain, the requery works fine. Because they are based on the selection in lbxMain with built in query data, it is almost like the ".Selected" property isn't enough to make access acknowledge the selection and update the criteria. If it helps, the criteria in the lbxList1 and 2 queries is Forms!frmMain!lbxMain
Happy to expand on something if you need more details! Thanks