By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,124 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,124 IT Pros & Developers. It's quick & easy.

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

P: n/a
Hi All,

I have a form and VB code in Access. The code is like
With rs
.Edit
!Field = 10
.Update
End With

When I chang a value on the form. then the error shows up.

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

Anyone has idea what cause that? Thanks in advance.

Dec 14 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
KK
In most cases, I have seen, this happens, if you have two subforms or
forms linked to the same table. If you try to edit the table from a
different form while the second form/subfrm (linked to the same table)
is open. I would check to see if you have the corresponding table
already open while this piece of code is running.
daniel wrote:
Hi All,

I have a form and VB code in Access. The code is like
With rs
.Edit
!Field = 10
.Update
End With

When I chang a value on the form. then the error shows up.

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

Anyone has idea what cause that? Thanks in advance.


Dec 14 '05 #2

P: n/a
I only have one main form.

Dec 14 '05 #3

P: n/a
Is the data in SQL Server and do you have any memo fields?

--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"daniel" <da*******@gmail.com> wrote...
I only have one main form.

Dec 14 '05 #4

P: n/a
daniel wrote:
Hi All,

I have a form and VB code in Access. The code is like
With rs
.Edit
!Field = 10
.Update
End With

When I chang a value on the form. then the error shows up.

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

Anyone has idea what cause that? Thanks in advance.


Any chance you are updating values in the AfterUpdate event? Is the RS
using the Recordsetclone of the form? What exactly is RS?

Dec 15 '05 #5

P: n/a
Rs is defined as follows:

squery = "SELECT * from Table1 where serial = " & !Serial
Set rs = db.OpenRecordset(squery, dbOpenDynaset, dbSeeChanges)
and I do not have memo fields.

Dec 15 '05 #6

P: n/a
the data is in sql server.

Dec 15 '05 #7

P: n/a
Daniel:

Add a timestamp column to each table in SQL Server. It helps
Access to determine if anyone has edited a record. This will
solve your problem. Doesn't matter how you name the field, just
put it out there and Access will find and use it.

Of course, you'll probably have to refresh your table links
so the new field(s) are visible.
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"daniel" <da*******@gmail.com> wrote ...
the data is in sql server.

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

Dec 15 '05 #8

P: n/a
the data is in sql server.

Dec 15 '05 #9

P: n/a
daniel wrote:
Rs is defined as follows:

squery = "SELECT * from Table1 where serial = " & !Serial
Set rs = db.OpenRecordset(squery, dbOpenDynaset, dbSeeChanges)
and I do not have memo fields.

I guess I didn't ask the right question. Sure, RS is a recordset. Is
it updating fields that exist on the form?

You are providing such minimal data that at this point I can only say
that your problem could be caused by a great number of causes.
Dec 15 '05 #10

P: n/a
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.

Dec 15 '05 #11

P: n/a
"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/
Dec 15 '05 #12

P: n/a
David W. Fenton wrote:
"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.

Exactly.
Dec 15 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.