Re: The data has been changed. Another user edited this record and saved the changes before you attempted to save your changes. Re-edit the record



"daniel" <danielblw@xxxxxxxxx> wrote in
news:1134667506.911789.241680@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

> 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/
.



Relevant Pages

  • Re: The data has been changed. Another user edited this record and saved the changes before you atte
    ... when I change field2 on the form, ... 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 ... than the obvious method of changing the form's underlying data, ...
    (comp.databases.ms-access)
  • Re: Form View using snapshot?
    ... Allen Browne - Microsoft MVP. ... controls instead of trying to modify the type of recordset the form uses. ... The add and edit work fine. ...
    (microsoft.public.access.formscoding)
  • Re: Edit Method in VB
    ... > I used to edit records in a module by using a tbl.Edit method. ... > under Tools, References, but it still doesn't work. ... but it won't work in my database. ... > method that can be used to edit a record in a recordset? ...
    (microsoft.public.access.modulesdaovba)
  • Re: Updating a recordset
    ... > recordset Addnew method, I can delete data but I can not ... > update the data using the Edit method. ... don't have the dot in front of your call to the Edit method. ... If the table is empty, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Form View using snapshot?
    ... Just run the locking code in the Load event of the form. ... controls instead of trying to modify the type of recordset the form uses. ... > The add and edit work fine. ...
    (microsoft.public.access.formscoding)