ACC2002: Write Conflicts Are Not Reported in Text or Image Data Type Fields in a Microsoft Access Project (295169)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q295169
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

When two users change the same record at the same time in a Microsoft Access project or in a Microsoft Access database connected to SQL Server, a write conflict message is not received if the data type of the field is Text or Image.

RESOLUTION

Create custom code that uses form events to check for write conflicts and to post a warning. To do so, follow these steps.
  1. Start Microsoft Access.
  2. On the Help menu, point to Sample Databases, and then click Northwind Sample Access Project.
  3. Minimize this instance of Access.
  4. Open a second instance of Access.
  5. Create a new project named Nwind2.adp connected to NorthwindCS.adp.
  6. Return to NorthwindCS.adp.
  7. Open the Categories form in Design view.
  8. On the View menu, click Code.
  9. Type or paste the following code:
    Dim strTemp As String
    
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    On Error GoTo MyForm_Err
    Dim cnn As ADODB.Connection
    Dim MyRS As New ADODB.Recordset
    Dim strOld As String
    Dim iAns As Integer
    
    Set cnn = CurrentProject.Connection
    MyRS.Open "select Categories.Description from Categories where CategoryID =" & Me.CategoryID, cnn, adOpenStatic
    
    strOld = MyRS!Description
    
        If Me.Description <> strTemp Then
    
        iAns = MsgBox("The record was changed by another user. Current record is: " & vbCr & vbCr & strOld _
         & vbCr & vbNewLine & "Your changes to record are: " & vbCr & vbCr & Me.Description & vbCrLf _
         & vbNewLine & "Do you wish to overwrite the current Record with the changes you made?" _
         & vbCr & "OK to keep your changes or Cancel to keep current record.", _
          vbOKCancel, "Write Conflict")
                If iAns = 2 Then
                Me.Description = strOld
                End If
       End If
    
    MyRS.Close
    Set MyRS = Nothing
    Set cnn = Nothing
    MyForm_Exit:
        Exit Sub
    
    MyForm_Err:
        Resume MyForm_Exit
    End Sub
    
    Private Sub Form_Current()
    If IsNull(Me.Description) Then
    
    Else
    strTemp = Me.Description
    End If
    End Sub
    					
  10. Save the form, and then view the form in Form view.
  11. Return to Nwind2.adp.
  12. Open the Categories table and edit the Description field in the first record. Change the record to "Soft drinks, coffees, teas, beers, and ales old."
  13. Move to the second record.
  14. Return to NorthwindCS.adp
  15. Edit the Description field in the first record. Change the record to "Soft drinks, coffees, teas, beers, and ales new."
  16. Move to the second record.
  17. Note that you receive the following message:
    The record was changed by another user. Current record is:

    Soft drinks, coffees, teas, beers, and ales old

    Your changes to the record are:

    Soft drinks, coffees, teas, beers, and ales new

    Do you wish to overwrite the current Record with the changes you made?
    OK to keep your changes or Cancel to keep current record.
  18. Click OK to keep your changes, or click Cancel to keep the current record.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Access.
  2. On the Help menu, point to Sample Databases, and then click Northwind Sample Access Project.
  3. Minimize this instance of Access.
  4. Open a second instance of Access.
  5. Create a new project named Nwind2.adp connected to NorthwindCS.adp.
  6. Open the Categories table.
  7. Return to NorthwindCS.adp, open the Categories table, and edit the Description field in the first record. Change the record to "Soft drinks, coffees, teas, beers, and ales old."
  8. Move to the second record.
  9. Return to Nwind2.adp.
  10. Edit the Description field in the first record. Change the record to "Soft drinks, coffees, teas, beers, and ales new."
  11. Move to the second record.

    Note that you do not receive a write conflict message.
  12. Return to NorthwindCS.adp
  13. On the Records menu, click Refresh.

    Note that the record reads "Soft drinks, coffees, teas, beers, and ales new."

Modification Type:MajorLast Reviewed:9/26/2003
Keywords:kbbug KB295169