Condition à l’événement change de ma combobox
Bonjour,
J'ai un combobox2, je souhaiterai qu'a l'évènemen ( change), la combobox3 affiche les valeurs conditionelles..Tout fonctionne bien. Mais quand j'ai la valeur ( 4ème Année) et combobox1 a la valeur ( ADULTE), la combobox3 affiche correctement " CONFIRMATION"...le problème survient si au prochaint évènement change de ma combobox2, sa valeur est ( 4ème Année) et que la combobox1 a pour valeur ( ENFANTS OU JEUNES), la combobox3 affiche " CONFIRMATION' au lieu de ( 5ème Année).
Quelqu'un pourrait il bien apporter une correction à mon code....
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Private Sub ComboBox2_Change()
Me.ComboBox3.Value = ""
If ComboBox2.Value = "PréCatéchuménat" Then
ComboBox3.Value = "1ère Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
Exit Sub
End If
If ComboBox2.Value = "1ère Année" Then
ComboBox3.Value = "2ème Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
Exit Sub
End If
If ComboBox2.Value = "2ème Année" Then
ComboBox3.Value = "3ème Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
Exit Sub
End If
If ComboBox2.Value = "3ème Année" Then
ComboBox3.Value = "BAPTÊME"
CommandButton3.Enabled = True
CommandButton5.Enabled = False
Exit Sub
End If
If ComboBox1.Value = "ENFANTS" And ComboBox2.Value = "4ème Année" Then
ComboBox3.Value = "5ème Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
Exit Sub
End If
If ComboBox1.Value = "JEUNES" And ComboBox2.Value = "4ème Année" Then
ComboBox3.Value = "5ème Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
Exit Sub
End If
If ComboBox2.Value = "5ème Année" Then
ComboBox3.Value = "CONFIRMATION"
CommandButton3.Enabled = True
CommandButton5.Enabled = False
Exit Sub
End If
If ComboBox1.Value = "ADULTES" And ComboBox2.Value = "4ème Année" Then
ComboBox3.Value = "CONFIRMATION"
CommandButton3.Enabled = True
CommandButton5.Enabled = False
Else
If ComboBox2.Value = "4ème Année" Then
ComboBox3.Value = "5ème Année"
CommandButton5.Enabled = True
CommandButton3.Enabled = False
End If
Exit Sub
End If
ComboBox3.Locked = False
End Sub |