Connecting Tech Pros Worldwide Help | Site Map

Write conflict error - single user database

  #1  
Old November 13th, 2005, 12:36 PM
rivka.howley@gmail.com
Guest
 
Posts: n/a
I recently added some code to the BeforeUpdate event of a text box on a
form. The code uses the new value in the text box to recalculate some
values in another table, which is shown in a subform on this form.
Since I've added the code, I get a Write Conflict error - "This record
has been changed by another user..." This typically does not happen the
first time I edit this text box after I open the form, but on every
subsequent time.

First, I'm not sure if this error is referring to the text box that I'm
modifying (manually) or to the table that I'm editing programmatically.
Second, I'm the only one using this database so I'm pretty sure it's my
code that's causing it.

I've seen many messages on this forum about this error, but nothing
that seems to resolve it. Has anyone had this or know how to fix it??
Thanks.

  #2  
Old November 13th, 2005, 12:37 PM
Albert D. Kallal
Guest
 
Posts: n/a

re: Write conflict error - single user database


That other user that changed things is your code!!

ms-access has no way of knowing that the data was changed by another user,
another program accessing the data, or your code!!

So, the problem is that you have a form that is attached to the data, and
editing has started. You then run some code, and instead of modify the data
in the form, you go and modify the data in the table. At this point, when
the form tries to save data, it checks the table, and realizes that someone
else (or code, or program etc) as changed the data.
[color=blue]
>
> I've seen many messages on this forum about this error, but nothing
> that seems to resolve it. Has anyone had this or know how to fix it??
> Thanks.[/color]

The above is a clear, and obvious explain of the problem.

The best solution is to FORCE the forms data to disk BEFORE you run code
that modifies that actual table data (or, change your code to modify the
forms data..and not directly to the table).

So, just go:

me.refresh ' force disk write.

your code that modifies the table goes here:

.....you re done!

Try the above, and post back here if it worked.

Maybe the next person will find this solution to this common problem and see
your answer!!

Good luck...

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal


  #3  
Old November 13th, 2005, 12:47 PM
rivka.howley@gmail.com
Guest
 
Posts: n/a

re: Write conflict error - single user database


I wonder if I try this code on the AfterUpdate event instead?? I am
going to experiment and I'll post back with what worked for me. Thanks!

  #4  
Old November 13th, 2005, 12:47 PM
rivka.howley@gmail.com
Guest
 
Posts: n/a

re: Write conflict error - single user database


All right, I got it to work! I did have to move this code to the
AfterUpdate event. I added Me.Refresh any place before I start editing
the table. No more error! I hope this helps someone else too.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write Conflict Error S.Dickson@shos.co.uk answers 1 November 13th, 2006 02:05 AM
Write Conflict: Form / Subform crystal@cinstall.com answers 4 June 26th, 2006 08:05 PM
Write conflict error w/ linked tables Smriti Dev answers 0 November 13th, 2005 10:56 AM
SQL-Server <-> A97 Write conflict error! Fardude answers 3 November 12th, 2005 06:33 PM
FYI: Avoiding write conflict errors in MS Access clients Andrew L. Gould answers 0 November 11th, 2005 11:40 PM