Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 12:36 PM
rivka.howley@gmail.com
Guest
 
Posts: n/a
Default Write conflict error - single user database

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
Default 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
Default 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
Default 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.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles