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!

Handling warning in comapi 1

Status
Not open for further replies.

shaccpac

Technical User
Sep 12, 2008
84
HI,
I was doing integration for IC shipment using COMAPI in vb.net if i get the accpac warning it should not goto error handler. I do not want my program to stop executing on warning.

Pls help my code is below.

ICSHE1headerFields.FieldByName("SEQUENCENO").PutWithoutVerification("0") ' Sequence Number
temp1 = ICSHE1header.Exists
ICSHE1header.Init()
temp1 = ICSHE1detail1.Exists
ICSHE1detail1.RecordClear()
temp1 = ICSHE1detail2.Exists
ICSHE1detail2.RecordClear()
ICSHE1header.Order = 3
ICSHE1headerFields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process Command
ICSHE1headerFields.FieldByName("HDRDESC").Value = "Accpac-Addons : No Payment - " & Desc ' Description
ICSHE1headerFields.FieldByName("TRANSDATE").Value = DateSerial(Today.Year, Today.Month, Today.Day)
ICSHE1header.Process()
ICSHE1headerFields.FieldByName("CUSTNO").Value = ObjRS1.Fields("CUST").Value.ToString.Trim ' Customer Number
ICSHE1headerFields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process Command
ICSHE1headerFields.FieldByName("REFERENCE").Value = "Reference - " & Ref ' Reference

'ICSHE1headerFields.FieldByName("PRICELIST").Value = "USA" ' Price List
ICSHE1headerFields.FieldByName("CURRENCY").Value = ObjRS1.Fields("CURID").Value.ToString.Trim ' Source Currency
ICSHE1headerFields.FieldByName("EXCHRATE").Value = ObjRS1.Fields("RATE").Value.ToString.Trim ' Exchange Rate

ICSHE1header.Process()

'ICSHE1headerFields("PRICELIST").Value = "GEFHSS" ' Price List
Do While Not ObjRS1.EOF
temp1 = ICSHE1detail1.Exists
ICSHE1detail1.RecordClear()
temp1 = ICSHE1detail1.Exists
ICSHE1detail1.RecordCreate(0)
ICSHE1detail1Fields.FieldByName("ITEMNO").Value = ObjRS1.Fields("ITEM").Value ' Item Number
ICSHE1detail1Fields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process Command
ICSHE1detail1.Process()
ICSHE1detail1Fields.FieldByName("LOCATION").Value = ObjRS1.Fields("FRMLOC").Value
ICSHE1detail1Fields.FieldByName("QUANTITY").Value = ObjRS1.Fields("TRNQTY").Value ' Quantity
ICSHE1detail1Fields.FieldByName("UNITPRICE").Value = ObjRS1.Fields("UPRICE").Value ' Location
ICSHE1detail1Fields.FieldByName("FUNCTION").Value = "100" ' Function
ICSHE1detail1.Process()
ICSHE1detail1.Verify()
ICSHE1detail1.Insert()
ICSHE1detail1Fields.FieldByName("LINENO").PutWithoutVerification("-1") ' Line Number
ICSHE1detail1.Read()
'temp1 = ICSHE1detail1.Exists
'ICSHE1detail1.RecordCreate(0)
ObjRS1.MoveNext()
Loop
ICSHE1header.Insert()
ICSHE1header.Order = 0
ICSHE1headerFields.FieldByName("SEQUENCENO").PutWithoutVerification("0") ' Sequence Number
temp1 = ICSHE1header.Exists
ICSHE1header.Init()
temp1 = ICSHE1detail1.Exists
ICSHE1detail1.RecordClear()
temp1 = ICSHE1detail2.Exists
ICSHE1detail2.RecordClear()
ICSHE1header.Order = 3

End If
Return 1
Exit Function
ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long
If mSession.Errors Is Nothing Then
MsgBox(Err.Description)
Else
lCount = mSession.Errors.Count
If lCount = 0 Then
MsgBox(Err.Description)
Else
For lIndex = 0 To lCount - 1
MsgBox(mSession.Errors.Item(lIndex))
Next
mSession.Errors.Clear()
End If
'Resume Next
End If

"SAVE TREES, SAVE WORLD, SAVE MANKIND" and print only if absolutely necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top