"Adrian Parker" <ad***********@NOSPAMsympatico.ca> wrote in message
news:wT********************@news20.bellglobal.com. ..
"Adrian Parker" <ad***********@NOSPAMsympatico.ca> wrote in message
news:EB********************@news20.bellglobal.com. .. I will change the data in a couple of the text boxes then
immediately try to do a INSERT to add another record. This returns errors like,
"operation not allowed in this context".
Is it possible to force the database to check the value of bound
fields, and immediately write them to the datasource fields in the database?
Particularly, if I change any of the values of a bound field, then run
any of the following without first using an adorecordset move (movenext,
last, etc), an error occurs:
.requery
.save
.close
As soon as one field of a recordset is edited, the recordset enters the
"Edited" state. When you move next, ADO performs an implicit "Update" on
the recordset. As you have noticed, it does not do that before Requery,
etc.
Basically you just need to check for the edited state, and perform
Update before doing other tasks. So, use something like:
If RS.EditMode <> adEditNone Then
RS.Update
End If
RS.Requery