Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order Detail Lot Number. Record Already Exists Error

Status
Not open for further replies.

oxie18

Programmer
Feb 17, 2015
40
CA
Hello again,

I'm trying to insert a lot number allocation on an order detail but I'm getting this error. Can someone please point out to me what I'm doing wrong? Thanks!

Code:
Private Sub adsOEORDDL_OnRecordChanged(ByVal eReason As AccpacCOMAPI.tagEventReason, ByVal pField As AccpacDataSrcCtl.IAccpacDSField, ByVal pMultipleFields As AccpacDataSrcCtl.IAccpacDSFields)
On Error GoTo ErrorHandler

    If eReason = RSN_FIELDCHANGE Then
        If pField.Name = "LOTNUMF" Then
            strLotNo = adsOEORDDL.Fields("LOTNUMF").Value
            
        ElseIf pField.Name = "QTY" Then
            adsOEORDDL.SetFireEvents False
            adsOEORDDL.GoBottom
            adsOEORDDL.RecordClear
            adsOEORDDL.RecordGenerate False
            adsOEORDDL.Fields("LOTNUMF").PutWithoutVerification (strLotNo)
            adsOEORDDL.Process
            adsOEORDDL.Insert
            adsOEORDDL.SetFireEvents True
            
            qtyAllocated = qtyAllocated + pField.Value
            lblAllocated.Caption = Format(qtyAllocated, "###,##0.0000")
            qtyRemaining = qtyLotRequired - qtyAllocated
            lblRemaining.Caption = Format(qtyRemaining, "###,##0.0000")
            
        End If
    End If
    
    Exit Sub
ErrorHandler:
    StdACCPACErrorHandler Me, mSession, mIResTmpl, True, True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top