Voici mes codes:
'*******************
' Proc?dure permettant
' de fermer le formulaire
' *********************
'*******************
' Proc?dure permettant de r?initialiser
' les champs du formulaire
'********************************
Private Sub Breg1_Change()
Feuil1.Range("J2").Value = Breg1.Value ' on affecte le noms du produit ? partir de sa r?ference
Breg2.Value = Feuil1.Range("K2").Value
End Sub
Private Sub BtnEffacer_Click() ' on note la combo pour un effacement
cboArticle = ""
txtDesignation = ""
TxtBoite = ""
TxtDate = ""
TxtMainsoeuvre = ""
TxtDebut = ""
TxtFin = ""
TxtOuverture = ""
TxtPause = ""
TxtStandbyp = ""
TxtChgtproduitp = ""
TxtChgtformatp = ""
TxtNettoyagep = ""
CboPanne1p = ""
TxtTempsp1 = ""
CboPanne2p = ""
TxtTempsp2 = ""
CboPanne3p = ""
TxtTempsp3 = ""
Txtlardons = ""
TxtOignons = ""
Txtmasse = ""
Txtpate = ""
TxtDechetpate = ""
TxtPertemasse = ""
TxtFonds = ""
TxtFondscreme = ""
TxtFondsgarnie = ""
TxtAttentec = ""
TxtChgtproduitc = ""
TxtChgtformatc = ""
TxtNettoyagec = ""
TxtRattrapage = ""
CboPanne1c = ""
TxtTempsc1 = ""
CboPanne2c = ""
TxtTempsc2 = ""
CboPanne3c = ""
TxtTempsc3 = ""
TxtNccdt = ""
TxtCdtfilmeuse = ""
TxtCdttunnel = ""
TxtCdtetuyeuse = ""
TxtCommentaire = ""
TxtMoyenneponderale = ""
End Sub
Private Sub btnfermer_Click()
Unload Me
End Sub
'*****************
' Proc?dure permettant d'acc?der
' ? la source de donn?e
' *****************
Private Sub BtnSource_Click()
Sheets("Source").Activate
Range("A1").Select
End Sub
'***************
' proc?dure permettant d'auter
' le bouton d'aujout d'enregistrement
'***************
Private Sub cboArticle_Change() ' on affecte le noms du produit ? partir de sa reference
Feuil1.Range("K2").Value = cboArticle.Value
txtDesignation.Value = Feuil1.Range("L2").Value
End Sub
Private Sub txtDesignation_Change()
If txtDesignation <> "" Then
BtnAjout.Enabled = True 'Activer le bouton
Else
BtnAjout.Enabled = False ' D?sactiver le bouton
End If
End Sub
'*****************************
' proc?dure permettant d' ajouter un nouvel enregistrement
' dans la base de donn?es
'*************************************
Private Sub BtnAjout_Click()
Sheets("Source").Activate
Range("A1").Select
Selection.End(xlDown).Select ' on se positionne sur la derniere ligne non vide
Selection.Offset(1, 0).Select 'on se d?cale d'une ligne vers le bas
ActiveCell = cboArticle.Value
ActiveCell.Offset(0, 1).Value = txtDesignation
ActiveCell.Offset(0, 2).Value = TxtDate
ActiveCell.Offset(0, 3).Value = TxtBoite
ActiveCell.Offset(0, 4).Value = TxtMainsoeuvre
ActiveCell.Offset(0, 5).Value = TxtDebut
ActiveCell.Offset(0, 6).Value = TxtFin
ActiveCell.Offset(0, 7).Value = TxtOuverture
ActiveCell.Offset(0, 8).Value = TxtPause
ActiveCell.Offset(0, 9).Value = TxtStandbyp
ActiveCell.Offset(0, 10).Value = TxtChgtproduitp
ActiveCell.Offset(0, 11).Value = TxtChgtformatp
ActiveCell.Offset(0, 12).Value = TxtNettoyagep
ActiveCell.Offset(0, 13).Value = CboPanne1p
ActiveCell.Offset(0, 14).Value = TxtTempsp1
ActiveCell.Offset(0, 15).Value = CboPanne2p
ActiveCell.Offset(0, 16).Value = TxtTempsp2
ActiveCell.Offset(0, 17).Value = CboPanne3p
ActiveCell.Offset(0, 18).Value = TxtTempsp3
ActiveCell.Offset(0, 19).Value = Txtmasse
ActiveCell.Offset(0, 20).Value = Txtpate
ActiveCell.Offset(0, 21).Value = Txtlardons
ActiveCell.Offset(0, 22).Value = TxtOignons
ActiveCell.Offset(0, 23).Value = TxtDechetpate
ActiveCell.Offset(0, 24).Value = TxtPertemasse
ActiveCell.Offset(0, 25).Value = TxtFonds
ActiveCell.Offset(0, 26).Value = TxtFondscreme
ActiveCell.Offset(0, 27).Value = TxtFondsgarnie
ActiveCell.Offset(0, 28).Value = TxtAttentec
ActiveCell.Offset(0, 29).Value = TxtChgtproduitc
ActiveCell.Offset(0, 30).Value = TxtChgtformatc
ActiveCell.Offset(0, 31).Value = TxtNettoyagec
ActiveCell.Offset(0, 32).Value = TxtRattrapage
ActiveCell.Offset(0, 33).Value = CboPanne1c
ActiveCell.Offset(0, 34).Value = TxtTempsc1
ActiveCell.Offset(0, 35).Value = CboPanne2c
ActiveCell.Offset(0, 36).Value = TxtTempsc2
ActiveCell.Offset(0, 37).Value = CboPanne3c
ActiveCell.Offset(0, 38).Value = TxtTempsc3
ActiveCell.Offset(0, 39).Value = TxtNccdt
ActiveCell.Offset(0, 40).Value = TxtCdtfilmeuse
ActiveCell.Offset(0, 41).Value = TxtCdttunnel
ActiveCell.Offset(0, 42).Value = TxtCdtetuyeuse
ActiveCell.Offset(0, 43).Value = TxtCommentaire
ActiveCell.Offset(0, 44).Value = TxtMoyenneponderale
MsgBox "Votre saisie a bien ?t? rajout?e ? la base de donn?es", vbOKOnly + vbInformation, "CONFIRMATION"
End Sub
Private Sub UserForm_Initialize()
TxtDebut = Format(Now, "hh:nn")
TxtFin = Format(Now, "hh:nn")
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
End Sub