'***********************************
'event bouton ajouter
'***********************************
Private Sub BtnValider_Click()
If ActiveControl.Name <> "BtnValider" Then Exit Sub
If NomPlante = "" Then MsgBox "pas de produit a ajouter": Exit Sub
If Me.PrixVente.Value = "" Then MsgBox "veuillez saisir le prix de vente SVP": Exit Sub
If CDbl(PrixVente) < CDbl(CoutRevient) Then MsgBox "prix de vente incohérent avec le cout de revient " & vbCrLf & "veuillez corriger cela SVP": Exit Sub
Dim X&, V, I&
With [BDProduit].ListObject
X = Application.IfError(Application.Match(NomPlante, .Range.Columns(1), 0), 0)
If X <> 0 Then MsgBox "ce produit exite déja" & vbCrLf & " Veuillez choisir un autre nom": Exit Sub
V = Array(NomPlante, CodeArticle, CdtPlante, PrixAchatPlante, CoeffPlante, "", "", DiamPot, CoeffPot, "", "", RefPlaque, CoeffPlaque, _
"", "", "", TxtCoutHrMO, TxtTempsMO, "", RefChromo, "", "", RefEntourage, "", "", RefEtiquette, "", "", RefCdt, "", QteSoie, "", QteCordelette, _
"", QteEtiCar, "", CoeffCdt, "", RefEmballage, Qte1, "", RefEmballage2, Qte2, "", RefEmballage3, Qte3, "", "", TxtRefAccessoire, _
TxtDetPrixAccess, TxtPrixAccessoire, TxtCoeffAccess, "", PoidsPlante, "", NomTransVente, "", CbTransporteur, PrixVente, "", _
Abs(ObNonRempotee), Abs(ObRempotee), Abs(ChbCoeffPot), Abs(ChbCoeffPlaque), Abs(ChbCoeffCdt), Abs(ChbCoeffAccess), Abs(ChbCoeffPlante))
For I = 0 To UBound(V)
If IsNumeric(V(I)) Then V(I) = CDbl(V(I))
Next
.ListRows.Add.Range.Value = V
End With
With Range("TbProduit").ListObject
.ListRows.Add.Range.Resize(, 4) = Array(NomPlante, CodeArticle, CDbl(PrixVente), Val(CdtPlante))
End With
triorder
rempliLesLISTE
suppl = suppl + 1
End Sub