Search code examples
vbams-access

MS Access - "This Record Has Been Changed By Another User Since You Started Editing It"


I know this has been asked many times, and I have tried many of the suggestions and solutions that worked for others, but I am not able to get this error to go away (please see attachment). Write Conflict Screenshot

This is an Access application that is really just a UI to a SQL Server database, and uses all linked tables to the SQL Server database. The user opens access and they go to a form that opens a "Search", where the user selects a bunch of criteria and clicks "Apply Filter". A list of records appears that meet their criteria. They click the record they want, and a form is opened that displays the details about this record. They then click an "Edit" button that opens another form that allows them to edit certain fields. When they make changes and hit save is when this error appears. The odd thing to me, this only occurs if the user selects the first record in the Search list, but it doesn't seem to happen with the others in the list.

What I have tried is the following:

  1. Added code on the "BeforeUpdate" and "Update Button Click" event to check "If Me.IsDirty = True Then Me.IsDirty = false" End If.
  2. Added a datetime column to the SQL database that gets updated with a trigger ON UPDATE
  3. Verified the database has no bit columns
  4. Changed the "Record Locks" property on the form to "Edit Records"

None of these items made a difference.

Any help on what might be causing this is appreciated.


Solution

  • 2. Added a datetime column to the SQL database that gets updated with a trigger ON UPDATE

    This could actually be the cause of your problem - Access and Sql Server modifying the same row at the same time is causing the write conflict you see.
    I'm afraid you have misinterpreted the valid advice you found.

    What you want is a ROWVERSION aka TIMESTAMP column in your Sql Server table. That helps Access figuring out if a row has changed and solve write conflicts. It is fully automatic and needs no trigger.

    More details (Albert always provides lots of details :p ) here:
    MS Access Write Conflict - SQL Server - Me = Dirty

    If this doesn't help: check if you have any other triggers, and post your VBA code for filter / edit / save.