Probleme de modification des champs dans ma base
Bonsoir mes leaders... j'ai plusieurs préoccupation. la première est : J'ai l'honneur de solliciter de l'aide afin de réussir mon programme sur excel et effet mon application au niveau du bouton modifier, lorsque je renseigne les information au niveau de la partie recherche, et je lui demande de modifier il modifie, la ligne 1 a chaque foie.... exemple je renseigne le code CND-000007, j'ai les informations, et je demande de modifier les champs du code, il me modifie les champs du code CND-000005... j'arrive pas apporte les modifications dans ma basse. merci de me répondre.... et la seconde est que je veux que la
Var = TxtPrenom.Text
ne soit pas le TxtPrenom, mais ma TxtCode avec la valeur de ma TxtCode.
voici moi code et mon formulaire et lorsqu'il modifie il garde toujours le meme code de l'inscrire sans la renommé merci de me répondre.
UserCND_2019
Code photo
Private Sub CbPhoto_Click()
Dim fichier As String
image_path = Application.GetOpenFilename(FileFilter:="Picture Files (*.gif;*.jpg;*.jpeg;*.bmp),*.gif;*.jpg;*.jpeg;*.bmp", Title:="Choisir image", MultiSelect:=False)
If image_path <> False Then
Image1.Picture = LoadPicture(image_path)
Image1.Visible = True
Var = TxtPrenom.Text
SavePicture Image1.Picture, ThisWorkbook.Path & "\" & "photos\" & Var & ".jpg"
End If
End Sub
UserProfil_CND
Bouton modifier
Private Sub CbModifier_Click()
Dim L As Integer
CND = Worksheets("BD_CND").Range("A1").CurrentRegion.Rows.Count
For L = 2 To CND
If Sheets("BD_CND").Cells(L, 1) = TxtCode.Value Then
Dim rep As Byte
rep = MsgBox("Voulez vous confirmer la modification?", vbYesNo + vbDefaultButton2 + vbQuestion, "Modification")
If rep = 7 Then
Exit Sub
Else
If CbClass = "" Then
MsgBox "veuillez préciser la Civilité", vbCritical, "Attention"
Exit Sub
End If
If TxtNom = "" Then
MsgBox "veuillez saisir le Nom", vbCritical, "Attention"
Exit Sub
End If
If TxtPrenom = "" Then
MsgBox "veuillez saisir le Prénom", vbCritical, "Attention"
Exit Sub
End If
If Not IsDate(TxtDate) Then
MsgBox "veuillez saisir une date naissance valide", vbCritical, "Attention"
Exit Sub
Else
Dim durée As Integer
durée = DateDiff("yyyy", CDate(TxtDate), Now())
If durée > 99 Then
MsgBox "veuillez saisir une date naissance valide", vbCritical, "Attention"
Exit Sub
Else
If CDate(TxtDate) > Now() Then
MsgBox "veuillez saisir une date naissance valide", vbCritical, "Attention"
Exit Sub
End If
End If
End If
If Len(TxtCont_1.Value) < 8 Then
MsgBox "veuillez saisir le N° de telephone", vbCritical, "Attention"
Exit Sub
End If
If TxtLieu = "" Then
MsgBox "veuillez saisir le lieu de naissance", vbCritical, "Attention"
Exit Sub
End If
If CbVil = "" Then
MsgBox "veuillez préciser la ville", vbCritical, "Attention"
Exit Sub
End If
If CbAcad = "" Then
MsgBox "veuillez préciser l'academie", vbCritical, "Attention"
Exit Sub
End If
If CbModule = "" Then
MsgBox "veuillez préciser le niveau de l'academie", vbCritical, "Attention"
Exit Sub
End If
If TxtSpe = "" Then
MsgBox "veuillez saisir la spécialité de l'academie", vbCritical, "Attention"
Exit Sub
End If
If CbPart = "" Then
MsgBox "veuillez preciser les frais de participation au camp", vbCritical, "Attention"
Exit Sub
End If
If CbClass = "" Then
MsgBox "veuillez saisir la classe du participant", vbCritical, "Attention"
Exit Sub
End If
If TxtClass = "" Then
MsgBox "veuillez saisir le nom du maître ou maîtresse de la classe ", vbCritical, "Attention"
Exit Sub
End If
Cells(L, 1) = TxtCode.Value
Cells(2, 2) = CbClass.Value
Cells(2, 3) = CbCivilite.Value
Cells(2, 4) = Trim(TxtNom.Value)
Cells(2, 5) = Trim(TxtPrenom.Value)
Cells(2, 6) = CDate(TxtDate.Value)
Cells(2, 7) = CDbl(TxtCont_1.Value)
Cells(2, 8) = Trim(TxtLieu.Value)
Cells(2, 9) = CbVil.Value
Cells(2, 10) = CbAcad.Value
Cells(2, 11) = CbModule.Value
Cells(2, 12) = Trim(TxtSpe.Value)
Cells(2, 13) = Trim(CbPart.Value)
Cells(2, 14) = Trim(TxtClass.Value)
Cells(2, 16) = Trim(TxtAf_Date.Value)
Cells(L, 17) = CDate(TxtDate_J.Value)
MsgBox "effectuée", vbOKOnly, "Modification"
End If
Exit For
End If
Next L
Unload Me
End Sub