View Full Version : Write Conflict - Urgent Help Need..


Ashfaque
10-11-2006, 05:51 AM
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?

FoFa
10-11-2006, 10:21 AM
Typically if you do not supply what you have defined as a unique key to that table (usually during the linking process) Access will stop you from updating that data because it is not sure what row it is tied to.
Usualyl I define an ID filed in SQL (just like Accesses autonumber) then I have no problems after that.

Ashfaque
10-13-2006, 09:43 PM
Thanks Fofa,

I have already set the Autonumber as PK to the footer table. When I add record first time in the footer table, It generates the autonumber bcz I know you can not add data in table of SQL Server without having primary key to the table.

Any other Ideas?

Thanks in advance...

Ashfaque

Ashfaque
10-14-2006, 09:53 PM
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

P_Henry
11-11-2007, 08:02 PM
Thank you...this really saved time!