How to circumvent the standard 'Write conflict' message

Posted on 2006-05-22
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
    LVL 4

    Expert Comment

    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

    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.
    LVL 4

    Expert Comment


    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
    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...?
    LVL 4

    Expert Comment

    Thanks.  Makes sense to me now. -HK

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now