davethegog
Instructor
I'm currently trying to update a field in a recordset based upon a variable defined in an earlier recordset.
eg recordset1 identifies field3 as the field to be updated so I've captured this data as a string. recordset2 will then update field3 with a specific value. I can't get the update to work. Should I prefix the fieldname with an "!"? Should I dim the field in another way. Any hints?
Dim fieldtoupdate as string
set rst1 = dbs.openrecordset("table1 queried"
with rst1
fieldtoupdate = rst1!updatefield
end with
rst1.close
set rst2 = ds.openrecordset("table2 queried"
with rst2
rst2!fieldtoupdate = "Value"
end with
rst2.close
eg recordset1 identifies field3 as the field to be updated so I've captured this data as a string. recordset2 will then update field3 with a specific value. I can't get the update to work. Should I prefix the fieldname with an "!"? Should I dim the field in another way. Any hints?
Dim fieldtoupdate as string
set rst1 = dbs.openrecordset("table1 queried"
with rst1
fieldtoupdate = rst1!updatefield
end with
rst1.close
set rst2 = ds.openrecordset("table2 queried"
with rst2
rst2!fieldtoupdate = "Value"
end with
rst2.close