Bonjour, je suis sous vb6, j'utilise une base access
je voudrais verifier si un champs est deja present dans la table avan de l'inserer, je n'arive pas a bien utiliser la methode find malgré mes recherches sur les forums;
C'est la premiere condition de l'iteration qui ne fonctionne pas!
Comment verifier si le prod existe dja avc find
Set Cn = New ADODB.Connection
Cn.Open "Provider=Microsoft.jet.OLEDB.4.0;Data Source=H:\poly.mdb"
Set Rs = New ADODB.Recordset
Rs.ActiveConnection = Cn
Rs.Open "select * from FDS", Cn, adOpenDynamic, adLockOptimistic
do until Rs.EOF=true
if Rs.find ("LIBELLE")="' & frmfiche.text2.text & '" =true then
msgbox("Le prod existe deja")
else
Rs.AddNew
Rs.Fields("CODE_PRODUIT") = frmfiche.lblnumdoc.Caption
Rs.Fields("LIBELLE") = frmfiche.Text2.Text
Rs.Update
Rs.Close
end if
end sub
merci de vottre aide