Good morning
I am setting up a "to_do" list in access. One of the field is the date the task was last completed. I want a button to update that date to the current date for the record that i am viewing on the form. Below is the code that I am using. When I click on my button, it updates the first record in my to-do table but not the current record displayed in my form.
Private Sub Cmd_Update_Click()
Dim DB As Database
Dim rs As Recordset
Dim i As Long
On Error GoTo Command4_Click_Error
Set DB = CurrentDb
Set rs = DB.OpenRecordset("to_dos")
rs.Edit
rs.Fields("DateCompleted") = Now()
rs.Update
On Error GoTo 0
Exit Sub
Command4_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description _
& ") in procedure Command4_Click of VBA Document Form_Form5"
End Sub
John