The data has changed...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am coding in Access 2003 VBA using DAO. The form that I am having problems
with is bound to a table(Orders) and has a subform bound to a child
table(LineItems). This form is used to enter orders and the subform is for
entering line items. Depending on the information entered into the subform
there is VBA code that edits information in the LlineItems table and can
create or delete LineItems records and then returns control to the form.

When the cursor is moved to a new LineItems record I get the following
message in a dialog box:

The data has changed.
Another user editied this record and saved the changes before you attempted
to save your changes...

How can I avoid getting this message?

Thanks,
Art
 
Can't tell without you providing some of your code that goes off and edits
records that you might be editing in the form/subform.
 
Duane,
I erred in quoting the dialog box. The title is Write Conflict and it
contains the following message: "This record has been changed by another user
since you started editing it..."

The code that edits the LineItem records is:


'Update the Order Line record if there is a sub-frame
strSQL = "SELECT * FROM tblOrderDetail WHERE (OrderNo = '" & gOrderNo & "'
AND Line = '" & gLine & "')"
Set rec = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

rec.Edit
If Forms!frmOrder!frmsubLineSpecs.Form!optSubFrame = "1" Then
If Mid(gProductCode, 3, 1) = "L" Then
CurrProd = "SFL"
CurrFill = "REL"
Else
CurrProd = "SFH"
CurrFill = "REH"
End If
rec("SubFrameCode") = CurrProd
rec("SubFrameDesc") = CreateDescription(CurrProd)
rec("SubFramePrice") = CalculateUnitPrice(CurrProd, gHW, 0)
If gFill > 0 Then
rec("FillCode") = CurrFill
rec("FillDesc") = CreateDescription(CurrFill)
Else
rec("FillCode") = ""
rec("FillDesc") = ""
rec("FillPrice") = 0
End If
Else
rec("SubFrameCode") = ""
rec("SubFrameDesc") = ""
rec("SubFramePrice") = 0
rec("FillCode") = ""
rec("FillDesc") = ""
rec("FillPrice") = 0
End If

rec("ItemDesc") = CreateDescription(gProductCode)
rec("UnitPrice") = CalculateUnitPrice(gProductCode, gW1, gH1)
rec.Update

rec.Close

Thanks,
Art
 
Duane,

I appologize for not responding sooner but I have been traveling repeatedly
to Florida in response to crisis in my mother's health. Unfortunately she
passed away on April 21 at the age of 98.

Today while reviewing my email I saw the notification of your last response
which had eluded me till now and will check it out. Thanks again.

Art
 
Back
Top