Datacombo et autocompletion
Bonjour, j'ai un petit prb avec un datacombo sur l'evenement (change) ce datacombo et lié a un recordset article qui le remplit correctement avec tte la liste des articles. Je voudrais faire de l'autocompletation de se datacombo mais cela plante dès que je tape une valeur ds la datacombo si je selectionne dans la liste cela fonctionne correctement pourquoi cela ?
dans le load :
Code:
1 2 3 4 5
| Rst1.MoveFirst
Set DataCombo2.DataSource = Rst1
Set DataCombo2.RowSource = Rst1
DataCombo2.BoundColumn = "id_article"
DataCombo2.ListField = "reference" |
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
| Private Sub DataCombo2_Change()
rafraichirchamps2
End Sub
Private Sub rafraichirchamps2()
Rst4.Close
Rst4.Open "SELECT sculfort_article.*, sculfort_fournisseur.* FROM sculfort_article LEFT JOIN sculfort_fournisseur ON sculfort_article.id_fournisseur=sculfort_fournisseur.id_fournisseur WHERE sculfort_article.id_article =" & DataCombo2.BoundText, cnx, adOpenKeyset, adLockOptimistic
If Rst4.RecordCount = 0 Then
MsgBox "vide"
Else
End If
If IsNull(Rst4("designation")) Then
designation.Text = ""
Else
designation.Text = Rst4("designation")
End If
datecodification.Text = Rst4("date")
If Rst4("stock") > 0 Then
Label10.ForeColor = vbGreen
Else
Label10.ForeColor = vbBlack
End If
Label10.Caption = Rst4("stock")
If IsNull(Rst1("description")) Then
description.Text = ""
Else
description.Text = Rst4("description")
End If
If IsNull(Rst4("prixht")) Then
prixht.Text = ""
Else
prixht.Text = Rst4("prixht")
End If
codebarre.Caption = "*" & DataCombo2.Text & "*"
datecodification.Text = Rst4("date")
If IsNull(Rst4("id_fournisseur")) Then
DataCombo1.Text = ""
Else
DataCombo1.BoundText = Rst4("id_fournisseur")
End If
End Sub |
Le rst1 correspond à l'ensemble des articles et le rst4 correspond à la fiche article.
Cordialement,
Corben