Cosmos75
Registered User.
- Local time
- Yesterday, 18:05
- Joined
- Apr 22, 2002
- Messages
- 1,281
I have a form with four sets of 15 comboboxes.
cboSetA1, cboSetA2, ..., cboSetA15
cboSetB1, cboSetB2, ..., cboSetB15
cboSetC1, cboSetC2, ..., cboSetC15
cboSetD1, cboSetD2, ..., cboSetD15
I need to set the properties for three of the sets based on the values in the first set.
so instead of having code like this in the forms After Update or Dirty event
but I'd have to repeat that 15 times. Or have the code repeated for each comboxes event (instead of the form's event).
Is there a way to do this with a loop? Something like
I have tried this and it doesn't work...

What I really need to happen is for the code to fire each time a combobox in SetA is changed, that the properties for the corresponding comboxes in Set B, C and D to change.
Any ideas? Is this even possible?

cboSetA1, cboSetA2, ..., cboSetA15
cboSetB1, cboSetB2, ..., cboSetB15
cboSetC1, cboSetC2, ..., cboSetC15
cboSetD1, cboSetD2, ..., cboSetD15
I need to set the properties for three of the sets based on the values in the first set.
so instead of having code like this in the forms After Update or Dirty event
Code:
Select Case me.cboSetA1.columns(1)
Case = 1
me.cboSetB1.visible = True
me.cboSetC1.visible = False
me.cboSetD1.visible = False
Case = 2
me.cboSetB1.visible = False
me.cboSetC1.visible = True
me.cboSetD1.visible = False
Case = 3
me.cboSetB1.visible = False
me.cboSetC1.visible = False
me.cboSetD1.visible = True
End Select

Is there a way to do this with a loop? Something like
Code:
For i = 1 to 15
Select Case me.cboSetA & i.columns(1)
Case = 1
me.cboSetB & i.visible = True
me.cboSetC & i.visible = False
me.cboSetD & i.visible = False
Case = 2
me.cboSetB & i.visible = False
me.cboSetC & i.visible = True
me.cboSetD & i.visible = False
Case = 3
me.cboSetB & i.visible = False
me.cboSetC & i.visible = False
me.cboSetD & i.visible = True
End Select
Next i

What I really need to happen is for the code to fire each time a combobox in SetA is changed, that the properties for the corresponding comboxes in Set B, C and D to change.
Any ideas? Is this even possible?
