Updating the Results of a Query Recordset

  • Thread starter Thread starter Mary Jane Steele @ hotmail dog com
  • Start date Start date
M

Mary Jane Steele @ hotmail dog com

I have created a Recordset using a joined query. I need
to update one of the fields in the recordset. Can I do
this via Recordset update command or do I have to run an
update query.
 
"Mary Jane Steele @ hotmail dog com"
I have created a Recordset using a joined query. I need
to update one of the fields in the recordset. Can I do
this via Recordset update command or do I have to run an
update query.

Assuming the query is updatable, you can use the recordset methods. Is
it a DAO or an ADO recordset? If it's a DAO recordset, your code would
be something like this:

With rs 'your recordset object, already opened

' ... Position to the record you want to update. Then ...

.Edit
!FieldToBeUpdated = NewValue
.Update

' ... do whatever else you may want to do with the recordset ...

.Close

End With

If it's an ADO recordset, I don't think you need to call the .Edit
method; just change the field and .Update it.
 
Back
Top