The form has five rows and two columns of combo boxes. For each row, the
first combo box is used to set the rowsource for the second. The sequence of
logical steps used is the same for each row, so there's a subroutine -
select_combo_data() - that I would like to initiate over and over, row by
row, with the only difference in the subroutine being the controls to which
it refers. That's where I think I need the variable. The code below works
fine for the first row of boxes (based on cb_choose1), but I want to make it
work for each of the rows. If I could refer to cb_chooseX and cb_criteriaX,
with the X changing to match the number of the calling control, it would do
what I want.
Private Sub cb_choose1_Change()
select_combo_data
End Sub
Private Sub cb_choose2_Change()
select_combo_data
End Sub
Private Sub cb_choose3_Change()
select_combo_data
End Sub
Private Sub select_combo_data()
If cb_choose1 = "Ordered by" Then
Me.cb_criteria1.RowSourceType = "table/query"
Me.cb_criteria1.RowSource = "ordering"
ElseIf cb_choose1 = "Attending" Then
Me.cb_criteria1.RowSourceType = "table/query"
Me.cb_criteria1.RowSource = "physician_IRattending"
ElseIf cb_choose1 = "Category" Then
Me.cb_criteria1.RowSourceType = "value list"
Me.cb_criteria1.RowSource = "'People';'Places;'Things'"
...there are eight more elseifs based on the options in cb_choose
endif
endsub
I'm not really clear about what you are doing, but you could create a
routine and call it in the AfterUpdate of each control that requires the
[quoted text clipped - 27 lines]