Private Sub AjoutPièceButton_Click()
Dim NouveauPiece As New Stock
Dim lg
If VéhiculeBox.Value = "" Or TypeBox.Value = "" Or PièceBox.Value = "" Or NombreBox.Value = "" Then
MsgBox "Veuillez renseigner ces informations !"
Else
With Feuil3
For lg = 2 To .[A65000].End(3).Row
'k étant la pièce et l le véhicule
If .Cells(lg, 1) = PièceBox And .Cells(lg, 2) = VéhiculeBox Then
MsgBox ("Pièce déjà existante pour ce véhicule" & Chr(10) & Chr(10) & "ANNULATION !"): Exit Sub
End If
Next
End With
Call NouveauPiece.CreerPièce(PièceBox, VéhiculeBox, TypeBox, NombreBox)
NouveauPiece.sauvegarder
Unload Me
End If
If Not IsNumeric(NombreBox1) Then
MsgBox ("Veuillez rentrer un nombre")
NombreBox.Text = Mid(NombreBox.Text, 1, Len(NombreBox.Text) - 1)
End If
Unload AjouterPièceForm
AjouterPièceForm.Show
End Sub