Sub Modif_valeur_Access()
Dim conn As ADODB.Connection
Dim Rst As ADODB.Recordset
Dim new_value As String, Ref As String, table As String
ActiveSheet.Unprotect
Application.ScreenUpdating = False
table = "table1"
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open "c:\\DBmodule.mdb"
End With
Set Rst = New ADODB.Recordset
Rst.Open table, conn, adOpenKeyset, adLockOptimistic
Ref = Sheets("Installation").Cells(2, 2).Value
new_value = Sheets("Installation").Cells(3, 2).Value
With Rst
.MoveFirst
.Find ("Reference=" & Chr(34) & (Ref) & Chr(34))
If Rst.EOF Or Rst.BOF Then
Rst.MoveLast
End If
.Fields("bonjour") = new_value
.Update
End With
Rst.Close
conn.Close
End Sub