Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Write conflict problem (2000 SP3)

    I have two subforms open on different tabs of a tabbed control. Both subforms are based on the same table, but with different filter criteria. Code behind one subform may need to alter the record currently open in the other subform. This code will only run whilst the first subform has the focus. As the focus then shifts to the second subform, I receive a write conflict warning. I don't think there is any possibility of a real write conflict. How can I get around this problem.

    I should point out that the field being modified by the code does not have a control bound to it on the subform. I should also add that to try and manipulate the data through controls would be very complicated, both for reasons of generalisability, and elements of poor design which I really don't have time to rectify now.

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    It may help if you requery the second subform before setting focus to it. If that doesn't solve the problem, can you tell us what kind of code you are using to alter the record in the second subform?

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Write conflict problem (2000 SP3)

    I believe I've come across a similar problem recently with my database...let me explain. I have a form with a listbox displaying all the records in my database on one side. On the remainder of the form, I have the changeable fields shown, so when a record is selected, the focus of the form shifts to that individual, and I may change whatever is necessary. However, after making changes and choosing another person, I get the error:
    ________________________________________
    The data has been changed

    Another user edited this record and saved the changes before you attempted to save your changes.

    Re-edit the record.
    (OkOnly)
    ________________________________________

    The record retains the changed value though. What gives? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    It depends on the way the form is designed and on the code used. We'd have to know details or see the database in order to know what exactly is happening in your situation.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Write conflict problem (2000 SP3)

    Hans, my form has tabs on it, each tab having a subform displayed on it linked to a separate table. The tables the subforms are based upon store different types of data on people (personal info, training info, address info, etc), all linked by a primary key (ssn). My list box is populated from my main table, and when I make changes to fields that lie on that table, that is when I get the error, however when I make changes to any of the tables other than the main table, I don't get the error. I think it has something to do with my listbox always being displayed on the form (on the side, next to the tabs), and never being requeried. If that's the case, how do I get it to requery after the data is changed without the error?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    Is the list box bound to a field, i.e. is the Control Source of the list box the name of a field in the table?

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Write conflict problem (2000 SP3)

    Hans, the control source of my list box is a query based on my main table (so I can apply various filters to the list box as I'm working).
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    That is probably the Row Source. I asked about the Control Source.

  9. #9
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Write conflict problem (2000 SP3)

    Right you are. I have no control source.

    [[wills self to pay more attention while on night shift]]
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    Could you post a stripped down and zipped copy of your database?

  11. #11
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Write conflict problem (2000 SP3)

    Hans,
    I'm working on stripping down the database, however until that happens, where do you suppose I would put DoCmd.Requery? For the Form_Change event?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    Can't say without seeing the database. Sorry.

  13. #13
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Write conflict problem (2000 SP3)

    Thanks Hans,

    I have tried your requery suggestion and it gives me the write conflict warning at the time of the requery (even though no changes, other than the one in code, had been made to the record in question).

    I am using the following code to change the field (DAO):

    Set rst = CurrentDb.OpenRecordset("SELECT * FROM Family_control WHERE [Number]='" & _
    Me!txtSampleNum & "'")
    If rst.RecordCount <> 0 Then
    rst.Edit
    rst!ErroneousSampExistWithThisNum = True
    rst.Update
    If Me!cboDiffSampNumType = 1 Then
    Parent!sfParental_Controls1.Requery
    ElseIf Me!cboDiffSampNumType = 2 Then
    Parent!sfCommunity_controls1.Requery
    Parent!sfCommunity_controls2.Requery
    End If
    End If
    Set rst = Nothing

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Write conflict problem (2000 SP3)

    The problem is that Access sees DAO as another process/user acting on the data. Try the following instead:

    Me.Parent.sfParental_Controls1.FormErroneousSampEx istWithThisNum = True
    Me.Parent.sfParental_Controls1.Requery

    FormErroneousSampExistWithThisNum does not need to be a control on the subform, but it must be a field in its record source, of course.

  15. #15
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Write conflict problem (2000 SP3)

    The reason I hadn't done that is that I have a number of situations and a number of forms, each of which would require "sfParental_Controls1" to be different (and possibly multiple).

    The possibilities are limited, so if this is the only way round then it is feasible, but for my edification, is there another way round? Should I learn ADO? Would that make a difference?

    Thanks

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •