Problème mot complété dans textbox!

js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 - 5 mai 2009 à 00:18
js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 - 5 mai 2009 à 00:34

2 réponses

js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 2
5 mai 2009 à 00:30
Désolé erreur de copier-coller

Bonjour à tous,

J'ai un textbox (txtproduit) à partir duquel dès qu'il y a une correspondance entre les caractères saisis et les occurences de ma table Article, alors il m'affiche un flexgrid (msfafficheprod) avec la liste des articles correspondants. Jusque là ça va. Le problème est que dans ma table article j'ai un champ prix et quantité. Il trie bien selon le nom mais l'affichage des prix et des quantités sont mélangés. Voici le code qu'il y a dans txtproduit_change :
connect

Dim str As String
If rsClt.State <> adStateClosed Then rsClt.Close
str = "select distinct * from TableProduit where desproduit like '" & txtproduit & "%'order by desproduit"
rsClt.Source = str
rsClt.Open
If Len(txtproduit.Text) >= 1 And rsClt.RecordCount >= 1 Then
msfafficheprod.Visible = True
End If

If txtproduit.Text = "" Then
msfafficheprod.Clear
msfafficheprod.Visible = False
ElseIf Len(txtproduit.Text) >= 1 Then
msfafficheprod.Clear
affiche_produit
End If

Voici le code de ma procédure affiche_produit:

Call connect

Dim c As Integer
connect
titre = Array("Numéro", "Désignation", "Qté en stock", "Prix Unitaire")
taille = Array(300, 2500, 2500, 1500)
For i = 0 To 3
msfafficheprod.ColWidth(i) = taille(i)
msfafficheprod.TextMatrix(0, i) = titre(i)
Next

If Len(txtproduit.Text) >= 1 And rsClt.RecordCount >= 1 Then

Dim rs1 As New Recordset
rs1.Open "select * from Tableproduit where desproduit like '" & txtproduit & "%' order by(desproduit) ", cn

Dim rs3 As New ADODB.Recordset
rs3.Open "select tablestock.qteenstock from tableproduit, tablestock where (tableproduit.numstock = tablestock.numstock) and desproduit like '" & txtproduit & "%' order by (desproduit)", cn, 1, 2


Dim rs4 As New ADODB.Recordset
rs4.Open "select tabletarif.pvprod from tableproduit, tabletarif where (tableproduit.numtarif = tabletarif.numtarif) and desproduit like '" & txtproduit & "%' ", cn, 1, 2


i = 1
While (Not rs1.EOF)
If Not IsNull(rs1) Then

msfafficheprod.TextMatrix(i, 0) = rs1(0)
msfafficheprod.TextMatrix(i, 1) = rs1(1)
msfafficheprod.TextMatrix(i, 2) = rs3(0)
msfafficheprod.TextMatrix(i, 3) = rs4(0)

End If
i = i + 1
rs1.MoveNext
rs3.MoveNext
rs4.MoveNext



Wend
msfafficheprod.Refresh
rs1.Close
rs3.Close
rs4.Close
cn.Close

Else

End If

Enfin voici le code mon msfafficheprod_click :

Call connect

txtproduit.Text = msfafficheprod.TextMatrix(msfafficheprod.Row, 1)
txtqteprod.Text = msfafficheprod.TextMatrix(msfafficheprod.Row, 2)
txtpuprod.Text = msfafficheprod.TextMatrix(msfafficheprod.Row, 3)

msfafficheprod.Visible = False

Merci d'avance.

Cordialement
0
js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 2
5 mai 2009 à 00:34
Grrrr,

je ne sais vraiment comment mettre en forme mon code et comment le mettre en exergue. Quelqu'un pourrait-il me dire comment faire s'il vous plaît? Merci d'avance.

Cordialement
0
Rejoignez-nous