Effacer contenu combobox

Résolu
aaliyan Messages postés 104 Date d'inscription samedi 12 mars 2005 Statut Membre Dernière intervention 30 avril 2007 - 17 avril 2007 à 09:22
aaliyan Messages postés 104 Date d'inscription samedi 12 mars 2005 Statut Membre Dernière intervention 30 avril 2007 - 17 avril 2007 à 09:52
Bonjour
Je voudrais effacer le contenu d'un combobox si je change la valeur d'une première combobox :
Domaine et sdomaine sont des combobox
Code :

Private Sub Document_Open()
      Call ThisDocument.domaine.AddItem("")
      Call ThisDocument.domaine.AddItem("?")
      Call ThisDocument.domaine.AddItem("??")
      Call ThisDocument.domaine.AddItem("???")
      Call ThisDocument.domaine.AddItem("????")
      Call ThisDocument.domaine.AddItem("?????")
End Sub


Private Sub domaine_Change()
      If domaine.Value = "?" Then
        'Effacement contenu sdomaine
        Call ThisDocument.sdomaine.AddItem("")
        Call ThisDocument.sdomaine.AddItem("?")


      ElseIf domaine.Value = "??" Then
'Effacement contenu sdomaine
        Call ThisDocument.sdomaine.AddItem("")
        Call ThisDocument.sdomaine.AddItem("?")
        Call ThisDocument.sdomaine.AddItem("??")
       
       
      ElseIf domaine.Value = "???" Then
'Effacement contenu sdomaine
        Call ThisDocument.sdomaine.AddItem("")
        Call ThisDocument.sdomaine.AddItem("?")
       
       
      ElseIf domaine.Value = "????" Then
        Call ThisDocument.sdomaine.AddItem("")
        Call ThisDocument.sdomaine.AddItem("?")
        Call ThisDocument.sdomaine.AddItem("??")
        Call ThisDocument.sdomaine.AddItem("???")
        Call ThisDocument.sdomaine.AddItem("????")
        Call ThisDocument.sdomaine.AddItem("?????")
        Call ThisDocument.sdomaine.AddItem("??????")
        Call ThisDocument.sdomaine.AddItem("????????")
        Call ThisDocument.sdomaine.AddItem("?????????")
        Call ThisDocument.sdomaine.AddItem("AUTRES")
       
       
      ElseIf domaine.Value = "?????" Then
        Call ThisDocument.sdomaine.AddItem("")
        Call ThisDocument.sdomaine.AddItem("?")
       
       
      ElseIf domaine.Value = "" Then
        Call ThisDocument.sdomaine.AddItem("")
       
      End If
End Sub

3 réponses

jrivet Messages postés 7392 Date d'inscription mercredi 23 avril 2003 Statut Membre Dernière intervention 6 avril 2012 60
17 avril 2007 à 09:27
Salut,
Pour effacer le contenu d'un combo.
Call ThisDocument.sdomaine.clear devrait fonctionner
@+: Ju£i?n
Pensez: Réponse acceptée
3
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
17 avril 2007 à 09:30
il s'agit de la méthode clear de ta combo.

De plus, au lieu de faire autant de test if, utilise plutôt un select case qui rendra ton code plus lisible.
0
aaliyan Messages postés 104 Date d'inscription samedi 12 mars 2005 Statut Membre Dernière intervention 30 avril 2007
17 avril 2007 à 09:52
Merci
0
Rejoignez-nous