Chargement dans un combobox

boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011 - 6 mai 2008 à 11:58
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 - 6 mai 2008 à 22:14
Bonjour, j'ai insérer un combobox dans mon application pour charger les données d'une table, mais il s'affiche que le premier enregistrement, quel problème s'agit t'il?

14 réponses

cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 12:06
Salut,


Moi, j'aimerais bien voir le code que tu utilises pour charger ta combo à partir de ta table.....


A+
Exploreur

 Linux a un noyau, Windows un pépin
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 12:15
Private Sub Form_Load()

        bd.Provider = "microsoft.jet.oledb.4.0"
        bd.ConnectionString = App.Path & "\bd_ordre.mdb"
        bd.Open

        
        tb.Open "select * from t1, t3", bd, adOpenDynamic, adLockOptimistic

        cmdannuler.Enabled = False
        cmdvalider.Enabled = False
        
        Call actualiser
        
        tb.MoveFirst

End Sub

Public Sub actualiser()

        'procédure qui permet d'utiliser des boutons
        'autre que adodc ou datacontrol,elle met à jour les textbox
        'suivant l'enregistrement sur lequel on se place par le biais
        'des boutons premier-dernier-précédent-suivant
        'Pour naviguer dans la B.D il faut que cette procédure
        'soit appeller dans chaque bouton
       
        'si début du fichier aller au dernier
        If tb.BOF = True Then
       
           tb.MoveLast
          
        End If
       
        'si fin du fichier aller au premier
        If tb.EOF = True Then
       
           tb.MoveFirst
          
        End If

        txtdate1.Text = IIf(IsNull(tb![date1]), "", tb![date1])
       
        txtnum_ins1.Text = IIf(IsNull(tb![num_ins1]), "", tb![num_ins1])
       
        txtnum_ins11.Text = IIf(IsNull(tb![num_ins11]), "", tb![num_ins11])
       
        txtdes1.Text = IIf(IsNull(tb![des1]), "", tb![des1])
       
        txtsuj1.Text = IIf(IsNull(tb![suj1]), "", tb![suj1])
       
        txtuser1.Text = IIf(IsNull(tb![user1]), "", tb![user1])
       
        txtnum1.Text = IIf(IsNull(tb![num1]), "", tb![num1])
       
        MonCombo.Text = tb![lib]
       
        txtremarque1.Text = IIf(IsNull(tb![remarque1]), "", tb![remarque1])

End Sub
0
jrivet Messages postés 7392 Date d'inscription mercredi 23 avril 2003 Statut Membre Dernière intervention 6 avril 2012 60
6 mai 2008 à 13:04
Salut,
Bah tout ça me semble normal non?
j'ai du mal a voir d'où vient le problème et surtout que souhaites tu faire exactement.

NOTE: on utilisera VbNullString au lieu de ""

@+: Ju£i?n
Pensez: Réponse acceptée
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 13:36
Re,

Je pense qu'il faut qu'il fasse un : tb.MoveNext

A+
Exploreur

 Linux a un noyau, Windows un pépin
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 13:39
Re,

Tiens essaye ceci si cela fonctionne :

Private Sub Form_Load()




bd.Provider = "microsoft.jet.oledb.4.0"
bd.ConnectionString = App.Path & "\bd_ordre.mdb"
bd.Open


       
tb.Open "select * from t1, t3", bd, adOpenDynamic, adLockOptimistic


cmdannuler.Enabled = False
cmdvalider.Enabled = False
       
       
While Not tb.EOF


    txtdate1.Text = IIf(IsNull(tb![date1]), "", tb![date1])
    txtnum_ins1.Text = IIf(IsNull(tb![num_ins1]), "", tb![num_ins1])
    txtnum_ins11.Text = IIf(IsNull(tb![num_ins11]), "", tb![num_ins11])
    txtdes1.Text = IIf(IsNull(tb![des1]), "", tb![des1])
    txtsuj1.Text = IIf(IsNull(tb![suj1]), "", tb![suj1])
    txtuser1.Text = IIf(IsNull(tb![user1]), "", tb![user1])
    txtnum1.Text = IIf(IsNull(tb![num1]), "", tb![num1])
    MonCombo.Text = tb![lib]
    txtremarque1.Text = IIf(IsNull(tb![remarque1]), "", tb![remarque1])


   ' Passe au suivant
     tb.MoveNext
    
Wend




' on ferme
 tb.Cancel
 tb.Close
 Set tb = Nothing




End Sub


A+
Exploreur

 Linux a un noyau, Windows un pépin
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 15:24
J'ai essayé le code mais il ne fonctionne pas ???
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 15:43
Euh....oui d'accord...précise ? C'est quoi qui ne marche pas ?

A+
Exploreur

 Linux a un noyau, Windows un pépin
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 15:46
Le combo affiche un seul enregistrement
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 16:06
Ah.....!

Remplace : MonCombo.Text par MonCombo.AddItem tb![lib]

A+
Exploreur

 Linux a un noyau, Windows un pépin
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 16:35
Le meme probleme vraiment j'ai pas compri
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 16:40
Pardon , ca marche mais chaque enregistrement s'affiche en trois occurence, pourquoi?
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
6 mai 2008 à 16:46
...lance ton prog en mode pas-à-pas pour comprendre pourquoi....

A+
Exploreur

 Linux a un noyau, Windows un pépin
0
boh1981 Messages postés 24 Date d'inscription jeudi 27 mai 2004 Statut Membre Dernière intervention 11 janvier 2011
6 mai 2008 à 17:06
Pardon, comment je fait ca?
0
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
6 mai 2008 à 22:14
F8
0
Rejoignez-nous