Modifying a Record
Sub Update_Record()
Dim conn As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "\mydb.mdb"
Set myRecordset = New ADODB.Recordset
With myRecordset
.Open "Select * from Employees Where LastName = 'Marco'", _
strConn, adOpenKeyset, adLockOptimistic
.Fields("FirstName").Value = "A"
.Fields("City").Value = "D"
.Fields("Country").Value = "USA"
.Update
.Close
End With
Set myRecordset = Nothing
Set conn = Nothing
End Sub
Related examples in the same category