"daniel" <da*******@gmail.com> wrote in
news:11**********************@g14g2000cwa.googlegr oups.com:
yeah, I updateing the files exist on the form.
public sub cal()
squery = "SELECT * from Table1 where serial = " & !Serial
Set rs = db.OpenRecordset(squery, dbOpenDynaset, dbSeeChanges)
With rs
.Edit
!Field1 = 10
.Update
End With
end sub
when I change field2 on the form, I call Cal(). If i change
field2 again, then the error shows up.
Why are you using a separate recordset to update data that is
already opened in the recordset behind the form you're using to edit
it?
Secondly, if you *are* going to update the data through something
than the obvious method of changing the form's underlying data, why
in the world are you opening a recordset with .Edit and .Update
instead of just using a SQL UPDATE query:
UPDATE Table1 SET Field1=10 where serial = " & !Serial
That will be faster and hold a lock on the table a shorter period of
time.
But I question why you are doing this in the first place.
Why not just update the field in the form's underlying recordset?
Doing it your way is just asking for exactly the kind of problem
you're seeing.
--
David W. Fenton
http://www.dfenton.com/
usenet at dfenton dot com
http://www.dfenton.com/DFA/