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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

build a list of records not in contract table given row column excel record

Status
Not open for further replies.

Mab-a

Programmer
Jun 19, 2019
8
0
0
GH

Hi,
I am trying to create a list of contract No that are not in the contract table given an excel row column.
However if record does not exist it throws an error
Any help in resolving this issue would be much appreciated.

Regards

For Each dr As DataRow In newContractDt.Rows
With arContract
.Init()
.Browse("FMTCONTNO = " & dr.Item(3).ToString, True)
If Not .Fetch(0) Then
'Else
Dim row As DataRow = tcardDettable.NewRow()
row("SEQ") = dr.Item(0)
row("LINENO") = dr.Item(1)
row("TIMECARDNO") = dr.Item(2)
row("FMTCONTNO") = dr.Item(3)
row("PROJECT") = dr.Item(4)
row("CATEGORY") = dr.Item(5)

tcardDettable.Rows.Add(row)
End If
End With
Next dr
 
You didn't say what line of code you get the error on or the error so I'm guessing here.

Change the arContract.Order to 3.

Use arContract.fields("FMTCONTNO").PutWithoutValidation dr.Item(3).ToString
if arContract.Read() = False then

...

end if
 
Hi DjangMan,
Thanks for your prompt reply,
Error occurs on (If Not .Fetch(0) Then) when record does not exist
Below is the error

sage 300 Error HRESULT E_FAIL has been returned from a call to a COM component.
at AccpacCOMSVR.AccpacSvrViewClass.FetchLock() at ACCPAC.Advantage.Server.View.Fetch(FieldValue[] putFieldValues, Int32[] getFieldIDs, Boolean lockRecord) at ACCPAC.Advantage.View.Fetch(Boolean lockRecord)

I will try your suggestion asap
Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top