Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to circumvent the standard 'Write conflict' message

Posted on 2006-05-22
Medium Priority
Last Modified: 2008-02-01
Hi, which form event do i put code on to circumvent the 'Write conflict' message?

I want to give my own version of the standard 'Write conflict' message box.

I have tried putting the code in the BeforeUpdate & Error events of the form but Access's standard message still appears.

Thank you,
Question by:ahearnden
  • 3
  • 2

Expert Comment

ID: 16733614
I posted a couple weeks ago about nearly the same issue.  As I recall, it was concluded that it isn't possible.  The write conflict message is not considered one to suppress.

You may try changing whatever is causing the error message.  The reason this occurs sometimes is because you are changing the record programmatically with an SQL statement while a form is open to the same record.  Access sees your code (SQL statement) and your form as two seperate "users", dare I say.  Thus the error message.
LVL 44

Accepted Solution

Leigh Purvis earned 500 total points
ID: 16733699
As HKComputer says - it's the sort of thing you should avoid - rather than ignore.
However - it could happen with legitimate concurrent use.

You can trap the error in the Form's Error event...

If DataErr = 7787 Then
    Msgbox "Whoopsie"
    Response = acDataErrContinue
End If

But you'd need to error handle well.

If it is being caused by a UI issue (not different users accessing the same data) then definately don't try doing this.
Tackle the issue.

Expert Comment

ID: 16733969

I see you can actually trap this error, something I wasn't aware of.  What is DataErr?  Is that yet another Err object?  Does it contain more errors than just the one in discussion?

>    Response = acDataErrContinue

Is Response a variable?

What happens when you use the above continue statement?  Does the current users data then get written to the database?
LVL 44

Expert Comment

by:Leigh Purvis
ID: 16734249
They're parameters from the Form's Error event procedure.
So in full it would look like

Private Sub Form_Error(DataErr As Integer, Response As Integer)
    If DataErr = 7787 Then
        Msgbox "Concurrent writing to the data for this record"
        Response = acDataErrContinue
    End If
End Sub

Without the options offered by the default dialog then the net result will just be the standard.  i.e. The first commited version wins.
So you'd probably just see the data refresh to show what the record now looks like - and let them go again...?

Expert Comment

ID: 16734316
Thanks.  Makes sense to me now. -HK

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question