Update record via DAO

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
 
A

Allen Browne

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top