Data has been changed Error Message

V

Vi

Hello All,

I am running a stand alone computer with only myself as
the only person accessing the database. I periodically get
this error message: "The data has been changed. Anotehr
user edited this record and saved the changes before you
attempted to save your changes. Re-edit the record."

Is there a solution for this? Or has anyone see this
before? Anything I can do about this?

Thanks in advance,
Vi
 
A

Allen Browne

This happens very easily without any other users.

Example of how it arises.
1. Open a form and start editing a record. Leave it unsaved: if you have the
Record Selector at the left of the form, it will show a pencil icon.

2. Leaving the form open, open the table in the database window, and start
editing the same record.

3. Switch back to the form, and try to save your changes. At this point you
will receive the conflict message.

To avoid the issue:
1. Always force a save in one form before opening another that uses the same
data. To explicitly force a save on a particular form regardless of whether
it has focus, set its Dirty property:
If Me.Dirty Then
Me.Dirty = false
End If

2. Always force a save before trying to do something that requires the
record to be saved, e.g. applying/removing a filter, changing a sort order,
reassigning a RecordSource, closing a form, moving record, etc.

3. In any code you write, explicitly close and dereference (set to Nothing)
any recordsets you open. The error can result from changes made in code as
well.

4. If you are use transactions in your code, make certain you have not left
uncommitted transactions, as discussed in the "traps" section of this
article:
http://allenbrowne.com/ser-37.html

5. Use optimistic locking, i.e. set:
Tools | Options | Advanced | Default Record Locking
to "No Locks".
You *may* also want to check the box "Open databases using record-level
locking", though I prefer not to (performance degrading, and possibly
buggy).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top