re salut ,
j'ai une procedure que je l'appelle pour modifier :
la fonction remplir_recordset :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 Private Sub modifier() Dim RSW As ADODB.Recordset SQL = "SELECT * From Permis " _ & " WHERE NumPerm='" & Trim(txtNumPerm) & "'" Set RSW = New ADODB.Recordset RSW.Open SQL, conec, adOpenStatic, adLockOptimistic If Not RSW.EOF Then Call Remplir_Recordset(RSW, Me) RSW.Update Unload Me End If End Sub
le probléme c'est qu'il me modifit tout les champs de la table sans le champ NumPerm et je sais pas pourquoi :s
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Public Function Remplir_Recordset(ByRef RS As ADODB.Recordset, ByRef frm As Form) Dim i As Integer Dim ctl As Control Dim NomTxtBox As String For Each ctl In frm.Controls If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then NomTxtBox = Right(ctl.Name, Len(ctl.Name) - 3) For i = 0 To RS.Fields.Count - 1 If RS.Fields(i).Name = NomTxtBox Then RS.Fields(NomTxtBox).Value = ctl.Text End If Next i End If Next ctl End Function
Partager