Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: Write Conflict - Urgent help needed...

    I used to add record thru a combo box in footer and leave some fields blank that need to fill later when a particular data arises. This was practiced before when my FE and BE both were Access dbs.

    But since I started using SQL Server (desktop version) as BE and Access MDB as FE, I face this problem that I can not update some of the fields of the records that I added.

    Let us say I have following fields in my footer form out of which some will be filled after a particular date arrival.
    RpoFId----------PK
    MQE_No
    RPO_No
    RPO_Desc
    Completion_Date
    Project_Completed --------Check box

    .
    Remark

    When add record, date fields would be empty because I need to feed them later. But I can not update the date fields next time once I come out of the form. My code was written after update event of Project_Completed which is check box It produced Write Conflict error (attached jpeg) at the code I wrote

    Private Sub Project_Completed_Click()
    Dim db As Database
    Dim frm As Form
    Dim EdRec As Recordset

    Set db = CurrentDb()
    Set EdRec = db.OpenRecordset("T_RPO_Footer")
    EdRec.Edit
    If IsNull(Me.Completion_Date) Then
    Completion_Date = Format(Now(), "MM/DD/YYYY")
    MsgBox "YOU MAY CHANGE COMPLETION DATE..", vbInformation, "INFORMATION"
    Me.Completion_Date.SetFocus
    Else
    EdRec!Project_Completed = 1
    End If
    EdRec.Update
    EdRec.Close
    End Sub

    I want to update any of the field I need without producing Write Conflict Error.

    Can somebody of you people help me out to correct above code?

    With kind regards,
    Ashfaque
    Attached Thumbnails Attached Thumbnails Write Conflict Error.JPG  

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372

    Hello Ashfaque!

    Try this in your code:

    Set EdRec = db.OpenRecordset("T_RPO_Footer", dbOpenDynaset)

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks

    But I tried already..

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    I may be talking out of my a... (again!) as I have no experiance this SQL back end, but, are Project_Completed and Completion_Date bound controls ?

    If so, then you do not need to use DAO (!?), try this

    Code:
    Private Sub Project_Completed_Click()
        If Project_Completed Then
            If IsNull(Completion_Date) Then
                Completion_Date = Date
                MsgBox "YOU MAY CHANGE COMPLETION DATE", TITLE:="Completion Click"
                Completion_Date.SetFocus
            End If
        'Else
        '    Completion_Date = vbNullString
        End If
    End Sub
    Other things I don't understand

    1) why you are changing the state of Project_Completed when this is the control just clicked (and changed) ??
    Is this the conflict ?

    2) you have formatted Now(). If you use 'Date' and the table field is a date type then it will not need formatting ?


    As I said, this could be all rubbish.


    MTB

  5. #5
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Thumbs down

    Thanks Mike,

    Yes, all fields are bound (forms's record source used as query that based on dbo_ table(s). Tables are already renamed later to their original names)

    I tried you trick also but the result is same as previous. The 2 fields casing error (bit fields) has set Allow Null with 0 default value.

    When I update Server table changing bit field datatype to datetime, wondering its working well. Is this the corect way ?


    The BE tables are on SQL server of Destop version. There is no network. Only a single pc..

    If chanding of Bit datatype to datetime is not the correct way then may I ask for any other ideas how can I Edit record of my footer form?

    Regards,
    Ashfaque
    Last edited by Ashfaque; 10-14-06 at 02:56.

  6. #6
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    I got it..

    I simply set Not Null of my BIT data type field and its default value to 0. Saved table.

    Initially it was again giving me error while editing / updating data tnto sub form. But when I deleted my old records from the table and run again it worked out.

    With kind regards,
    Ashfaque

Posting Permissions

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