The datasheet subform pictured below has a combo box in every cell. If you select a new value in one of the cells to the left, the cells to the right need to requery and be set to null (as the combo boxes to the right are filtered by the ones on the left). If there is only one row in the datasheet, my code works well. If there's more than one, however, my code resets all the combo boxes to the right, across all rows (which is bad). What do I need to change in my code (listed further below) to only reset the fields on the same row as the combo box being selected?
Here's the VBA on the first combo box:
Private Sub cbo_LOA_Segment1_AfterUpdate()
' requery all subsequent LOA combo boxes to
' show only LOAs matching the selected Agency AND that match the earlier LOA entries
With Me
!cbo_LOA_Segment2 = Null
!cbo_LOA_Segment2.Requery
!cbo_LOA_Segment3 = Null
!cbo_LOA_Segment3.Requery
!cbo_LOA_Segment4 = Null
!cbo_LOA_Segment4.Requery
!cbo_LOA_Segment5 = Null
!cbo_LOA_Segment5.Requery
!cbo_LOA_Segment6 = Null
!cbo_LOA_Segment6.Requery
!cbo_LOA_Segment7 = Null
!cbo_LOA_Segment7.Requery
!cbo_LOA_Segment8 = Null
!cbo_LOA_Segment8.Requery
!cbo_LOA_Segment9 = Null
!cbo_LOA_Segment9.Requery
!cbo_LOA_Segment10 = Null
End With
End Sub