My form has a Subform in Datasheet View. That subform's leftmost-column is a checkbox called "flagged". Every time the user puts a check in that box, I count up all the rows in that datasheet that are flagged, and display it on a label in the main form. Here's that code, and it works fine:
Let's pretend this code just successfully counted 10 flagged rows. Trouble is, when the user applies a filter to that Datasheet, and narrows it down to, say, only 3 flagged orders, the label still displays 10. No problem: I just need to fire this code AFTER the user applies a filter... but I cannot find an event to do that.Code:'Count Flagged Orders: Do While Not rs.EOF If rs![Flagged] = True Then intCounter = intCounter + 1 End If rs.MoveNext Loop 'Display that total number in a label control: Forms![order manager]!lblSelectedOrderCount.Caption = intCounter
I found an event called "On Filter" which does fire when the user applies a filter, but the trouble is, the above code will not work - the "rs" recordset object still has the old number of rows in it... to put another way, the "On Filter" event is fired AFTER the user applies a filter, but BEFORE the filter is applied to the recordset object.
Any ideas how to skirt this issue? Thank you for your consideration of my issue.