Update record via DAO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was trying to loop through a table using DAOs and it was
working fine untill I attempted updating a record. I used
the following code:

rst.Fields("strName").Value = "Hello"

and recieved an error "Update or CancelUpdate without
AddNew or Edit".

I was just wondering if there was a way to change the
value of strName, or whethere it is only read only.

Thanks in advance
 
You need to Edit before you can set the value, and the Update to commit the
change:

rst.Edit
rst.Fields("strName").Value = "Hello"
rst.Update
 
Back
Top