Access "Write Conflict" Error -- record changed by another user

  • Thread starter Thread starter RoberzieB
  • Start date Start date
R

RoberzieB

A table with 2 fields in which the data are correlated (but not coupled) are
populated by ComboBoxes with sources from a separate table with the
correlated information in the same records. Specifically, Company Name and
Stock symbol. The form used to enter and edit information in the master
table allows the selection of unrelated Company Name and Stock Symbol. Using
a RecordSet, ToDo Loop, and an UPDATE query, I have "sort of" accomplished
the job. Changing the selection of the Company Name generates the above
error message. Clicking the "Drop Changes" button produces another error
message -- "You can't save this record at this time. . . . Do you want to
close anyway? "Yes" closes the form. When the form is reopened, it displays
the intended updated Company Name and its appropriately updated stock symbol
(and the underlying table is properly updated). Other forms in the program
employ record sets. I believe these record sets and connections are properly
closed. Any clues ??
 
That other user of course is actually your code that's doing an update when
a form has pending disk writes.

in other words all the form knows that somebody else or some other code or
some other application ran by and modified the current record that the forms
is on. In other words ms access detects that the current record that it's
about to write will note that the reocrd on disk has been changed by
someone else.

The simple solution is in your code that runs the update and do loop query
simply force it to write the current form data. So simply flush the current
forms "pending" write data to disk. Once you do that then you're free to run
the SQL update or record set code actually modifies the the same record that
the form is currently on.

eg:

if me.dirty = true then
me.dirty = false
end if

......nowrun your udpate code here.

since reform will not have any pending disk rates that point I'm, then
you'll elimoonate that message.

In fact in most cases even when I have a current form that launches antoher
form, I as a general rule force a disk write at that point. This tends to
make my applications more reliable in the case of the applicaton freezing up
or the comptuer havig problems. Since the current record will have been
written to disk, I don't loose data if 5 forms are opened. And, the
additional benefit of this approach is that you don't get the conflict about
a record being updated by someone else.
 
Albert D. Kallal said:
That other user of course is actually your code that's doing an update when
a form has pending disk writes.

in other words all the form knows that somebody else or some other code or
some other application ran by and modified the current record that the forms
is on. In other words ms access detects that the current record that it's
about to write will note that the reocrd on disk has been changed by
someone else.

The simple solution is in your code that runs the update and do loop query
simply force it to write the current form data. So simply flush the current
forms "pending" write data to disk. Once you do that then you're free to run
the SQL update or record set code actually modifies the the same record that
the form is currently on.

eg:

if me.dirty = true then
me.dirty = false
end if

......nowrun your udpate code here.

since reform will not have any pending disk rates that point I'm, then
you'll elimoonate that message.

In fact in most cases even when I have a current form that launches antoher
form, I as a general rule force a disk write at that point. This tends to
make my applications more reliable in the case of the applicaton freezing up
or the comptuer havig problems. Since the current record will have been
written to disk, I don't loose data if 5 forms are opened. And, the
additional benefit of this approach is that you don't get the conflict about
a record being updated by someone else.
Thank you very much. I appreciate the help RoberzieB
 
Back
Top