Write Conflict Error when Updating Record

dungstar

Registered User.
Local time
Today, 12:30
Joined
Mar 13, 2002
Messages
72
I have an Edit form that allows the user to move the location of a record. When the record is moved by press of a command button, the VBA code simply runs an Update query to change the ID of the record referring to a different location.

Then I would like to refresh the form by this line at the end of the command button procedure:
DoCmd.OpenForm "frmEditSample", acNormal, , "SampleID = " & Me.SampleID
(also used Form.Refresh)

When this action is done the first time since the form has been loaded, I get a
Write Conflict Error with the options of: Save Changes, Copy Changes to Clipboard, or Drop Changes.
If I select Drop Changes (or Copy Changes) it works fine.

If I repeat this moving of a record while the form is still open, I do not get this Write Conflict error.

I thought it was the refreshing of the form that was triggering it, but I commented that line out. The message will still appear, this time when I attempt to close the form.

The form is bound to a query. The update statement updates a table used in the query. Perhaps this is where the conflict occurs. If so how do I get around this (and why does it work fine after the first time)? Maybe if I unbind the form from the query, run the updates, then rebind the recordsource? But how do I unbind the form? (Tried Me.Recordsource = "", but I get an validation error.) (Sorry... it's getting a real late...)

Is there a way to automatically select the "Drop Changes" option when this prompt pops up in this form? (Or better yet, avoid it?!)

Please help! Thanks!
 
Thanks, Tim! That's a very clever idea. Not the best approach to conquer this nuisance of a problem, but it works fine for me.
 

Users who are viewing this thread

Back
Top Bottom