[AccessD] Write Conflict

Charlotte Foust cfoust at infostatsystems.com
Wed Feb 25 10:19:23 CST 2009


Are the parent and the subform bound to the same dataset?  That's what
usually causes write conflicts in my world, because you have two
datasets open, or at least two connections to the same dataset.  What
happens if you force  an update on the parent form after setting the
value?

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William
Hindman
Sent: Wednesday, February 25, 2009 7:16 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Write Conflict

...first time I've seen this one

...cbf
------------------------------------------------------------------------
-----------------
Option Compare Database
Option Explicit

Private Sub cboParticipantType_AfterUpdate()
    ' Force save and refresh records

On Error GoTo HandleErr

    DoCmd.RunCommand acCmdSaveRecord
    Me.Requery

exithere:
    Exit Sub

HandleErr:
    Select Case Err
        Case Else
            MsgBox Err & ": " & Err.Description, vbCritical, _
             "Error in
Form_frmCompanyEventsSub.cboParticipantType_AfterUpdate"
    End Select
    Resume exithere
    Resume

End Sub

Private Sub Form_Dirty(Cancel As Integer)
        'MsgBox "Record Changed"
    On Error GoTo Form_Dirty_Error

        Parent!txtUpdated = Date   'update the LastUpdated to today's
date 
if the form record was changed.
        Parent!txtUpdateBy = Environ("USERNAME")
        Me.Repaint

   On Error GoTo 0
   Exit Sub

Form_Dirty_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure Form_Dirty of VBA Document Form_frmCompanyEventsSub"

End Sub

------------------------------------------------------------------------
-----------------

...the Form_Dirty is the new code ...works elsewhere in main forms
without problems ...but this is a sub and I'm changing field data on the
parent.
...I get a Write Conflict dialog box "This record has been changed by
another user" with three buttons:
 "Save Record" "Copy to Clipboard" "Drop Changes" ...annoying to say the
least ...any idea why this is happening?

William
 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list