Write conflict over-ride?

M

Merlin

Hi guys
I have some code on a subform which changes a record that is displayed on a
different subform. The changes should overwrite whatever is there already.
When I move off the screen, or to another record, I get the "Write Conflict"
dialogue box asking if the wants to "Save Record", "Copy to Clipboard" or
"Drop Changes".
Is there a way I can tell the system to drop changes without asking the user?

AccessXP, SQL Server 2000.

Thanks
 
S

Sylvain Lafontaine

First, you have to made sure that this error really comes from the fact that
two of your users have changed the data at the same time. If one user open
two forms on the same data or if the table has some types of field (don't
remember exactly which one) then you might see this error without having two
users updating the data at the same time. See for example:

http://support.microsoft.com/kb/304181/en-us?spid=2509&sid=216

http://support.microsoft.com/kb/295225/

One easy of checking this would be to take a look with the SQL Server
Profiler to see which commands are sent to the server.

Usually, this shouldn't happen if your database is well normalized as there
is usually no reason that two of your users should update the same data at
the same time but if this happens (for example, the same house is sold
twice) then overwriting the new data entered by someone else without warning
is probably a bad thing.

The first thing to do is to make sure that you cannot rearrange your design
so that this won't happen.

But if you cannot do that, then one possibility would be to test the backend
data with an sql select command in the OnBeforeUpdate event to see if the
data has not been changed. One way of doing this could be to set up a
timestamp and check its value; otherwise you will have to test all values.
If there has been a change, then manually change the data on the backend
with code using the new data and after that undo and cancel the current
update and refresh the data.

Often, when people are confronted to this problem, they will chose to use an
unbound form instead of a bound form and make the updates themselves. This
is probably the easiest solution.
 
M

Merlin

Thank you for taking the time to reply.
It wasn't entirely relevant, but reading it gave me an idea that ended up
solving my problem.
So thank you!
 

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