Skip to Content
0
Former Member
Jun 09, 2006 at 04:15 PM

'Row in Transaction with Account No.' Error occurs when add Journal Entry

55 Views

Hi everyone,

I would like to add a new Journal Entry which base on an exists Journal Entry, the all information in lines are same beside the Credit/Debit direction, I call this as Reverse Journal Entry, I define a new Journal Entry object which equals the original Journal Entry, and only change the Debit value to the Credit, my code shows below, when I use Add method to add to the reverse Journal Entry, error occurred as:

"-5011:[JDT1.Account][line:1],'Row in Transaction with Account No.'"

I checked the Account is active Account and it should work, because the original Account has already add the Journal Entry Lines.

If objJE.GetByKey(JdtNum) Then

objJEReverse = Nothing

objJEReverse = objJE

With objJEReverse

If .Lines.Debit <> 0 Then

dLineValue = .Lines.Debit

.Lines.Debit = 0

.Lines.Credit = dLineValue

Else

If .Lines.Credit <> 0 Then

dLineValue = .Lines.Credit

.Lines.Credit = 0

.Lines.Debit = dLineValue

End If

End If

For iLine = 1 To objJEReverse.Lines.Count - 1

.Lines.SetCurrentLine(iLine)

If .Lines.Debit <> 0 Then

dLineValue = .Lines.Debit

.Lines.Debit = 0

.Lines.Credit = dLineValue

Else

If .Lines.Credit <> 0 Then

dLineValue = .Lines.Credit

.Lines.Credit = 0

.Lines.Debit = dLineValue

End If

End If

Next

End With

If objJEReverse.Add() <> 0 Then

_Company.GetLastError(iErrCode, sErrDes)

MessageBox.Show("Error occurs during create Reverse Journal Entry" & vbCrLf & iErrCode & ": " & sErrDes, "My Addon", MessageBoxButtons.OK, MessageBoxIcon.Information)

End If

Who can help me point the problem,

Thanks in advance!

Kathy