Private no_ligne As Integer
Private Sub ComboBox1_Change()
If ComboBox1.Value <> "" Then
no_ligne = ComboBox1.ListIndex + 4
Cherche
End If
End Sub
Private Sub ComboBox2_Change()
If ComboBox2.Value <> "" Then
no_ligne = ComboBox2.ListIndex + 4
End If
End Sub
Private Sub CommandButtonModifier_Click()
If Not IsOKTxtBx Then
MsgBox "Veuillez renseigner les champs obligatoires (*)"
Exit Sub
End If
modifier
End Sub
Private Sub CommandButton_annuler_Click()
Unload Me
End Sub
Sub Cherche()
ComboBox1.Value = Cells(no_ligne, 1).Value
ComboBox2.Value = Cells(no_ligne, 2).Value
TBNom.Value = Cells(no_ligne, 2).Value
TBPre.Value = Cells(no_ligne, 3).Value
TBSoc.Value = Cells(no_ligne, 5).Value
TBAd1.Value = Cells(no_ligne, 6).Value
TBCp.Value = Cells(no_ligne, 7).Value
TBVille1.Value = Cells(no_ligne, 8).Value
TBPays1.Value = Cells(no_ligne, 9).Value
TBAd2.Value = Cells(no_ligne, 11).Value
TBCp2.Value = Cells(no_ligne, 12).Value
TBVille2.Value = Cells(no_ligne, 13).Value
TBPays2.Value = Cells(no_ligne, 14).Value
TBTel.Value = Cells(no_ligne, 16).Value
TBNais.Value = CDate(Cells(no_ligne, 17).Value)
TBMail.Value = Cells(no_ligne, 18).Value
TBInf.Value = Cells(no_ligne, 19).Value
End Sub
Sub modifier()
With Sheets("CLIENTS")
.Cells(no_ligne, 2) = TBNom.Value
.Cells(no_ligne, 3) = TBPre.Value
.Cells(no_ligne, 5) = TBSoc.Value
.Cells(no_ligne, 6) = TBAd1.Value
.Cells(no_ligne, 7) = TBCp.Value
.Cells(no_ligne, 8) = TBVille1.Value
.Cells(no_ligne, 9) = TBPays1.Value
.Cells(no_ligne, 11) = TBAd2.Value
.Cells(no_ligne, 12) = TBCp2.Value
.Cells(no_ligne, 13) = TBVille2.Value
.Cells(no_ligne, 14) = TBPays2.Value
.Cells(no_ligne, 16) = TBTel.Value
.Cells(no_ligne, 17) = CDate(TBNais.Value)
.Cells(no_ligne, 18) = TBMail.Value
.Cells(no_ligne, 19) = TBInf.Value
End With
MsgBox ("Modification effectuer")
Unload uf_client
uf_client.Show 0
End Sub
Private Function IsOKTxtBx() As Boolean
Dim Ctrl As Control
IsOKTxtBx = True
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.TextBox Then
If LCase(Ctrl.Tag) = "fill" And Len(Trim(Ctrl.Value)) = 0 Then
Ctrl.SetFocus
IsOKTxtBx = False
Exit Function
End If
End If
Next Ctrl
End Function