473,418 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

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

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
12 10908
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
I only have one main form.

Dec 14 '05 #3
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
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
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
the data is in sql server.

Dec 15 '05 #7
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
the data is in sql server.

Dec 15 '05 #9
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
9
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this...
2
by: Matthias S. | last post by:
Hi, I have to write an application which extensively uses an SQL Database. For a simple example say I have the following tables with the appropriate fields. 1. Company (ID, Name,...
6
by: Frank Esser | last post by:
Hallo, I've got a project with about 10 pages. On each of them the user can do data changes (mostly datagrid interactions; the datagrids are bound to datasets). The user is able to jump to...
1
by: Jim | last post by:
I have a datagrid on a windows form that is filled using a data adapter and dataset created in code. I have mapped columns to the various fields. The user enters new infromation into the grid and...
5
by: Bob | last post by:
Using Vs 2005 and Vb.NET I want to give users a message asking if they're sure they want to close the form if they had made changes to the underlying data. How do I detect if changes had been made...
19
by: Taras_96 | last post by:
Hi everyone, How do you detect that a form element has been changed? This thread: ...
3
by: ~john | last post by:
I'm working on a multi-user system that at times may result in 2 users accessing the same screen. These screens allow the users to both view and update data. The problem comes when you have user A...
2
by: Midsomer | last post by:
Hi. I have an Access database with a form containing 4 datasheets and I allow the user to change column widths. On closing the form, a routine is fired that saves each column width to an INI file....
1
by: raz230 | last post by:
I have a vb.net project. I am using app.config to store some data that I want the user to be able to change. I do this: My.Settings.Host = txtURL.text.trim My.Settings.Save My.Settings.Reload...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.