cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Kathy,

Maybe the problem is that you are trying to

use a wrong way to add a journal entry.

In general,we can make success to insert journal

entrys by assigning every field and add lines

step by step.

Because the journal entry add method is a diapi

object,we can't imagine what it will happen to

use the reversing journal entry way.

The easiest way is to transfer the reversing

journal entry to a new journal entry object and

to add it by the "old" method.

HTH

ANDREW CHU

Former Member
0 Kudos

Hi Andrew,

Thanks for your replying.

I am using VB .Net, although there isn't a direct way to set the reverse Journal entry using DI API, and I agree with you, to set all properties for original JE to the new reverse JE object can implement the purpose, but I think for the reverse JE beside the Credit value and Debit Value direction different, all other properties are same, why should we set the properties one by one again, we might lost some properties when we set the new Reverse JE manually. we can use a new object as Reverse JE and set the original JE to the new JE, then the New JE have all values in original, actually the New JE's Account code property is the Original JE Account code, but the strange thing is that I need set this property again, then the error disappear. Although the problem is solved now, but I still want to know why the JE object value can see after transfer from another JE, but need set the Account Code again then the JE Add method works.

Thanks,

Kathy

former_member184566
Active Contributor
0 Kudos

HI Kathy

I just took a quick look. I'm assuming you are using the di api to get the key. But now when making the reversal entry i can't make out two vital things.

1) Where you assigning your gl account.

2) Once the rows are greater than 1 do add row.

Hope this helps

Former Member
0 Kudos

Hi Louis,

Thanks for your replying, and for your question, my answer shows below:

1) I use new Journal Entry object equals the original Journal entry, then the GL account and all other properties of original Journal entry transfer to the new Journal Entry.

2) Because I use original Journal Entry as the new Journal Entry, I think all lines of Original Journal Entry will transfer to the new Journal entry automatically.

Actually this problem is already solved by set the New Journal Entry account code, but I still do not know, why should I set the New Journal Entry Account code again, I wonder if this is a bug of DI API, because after I set the new Journal entry equals the original Journal Entry, I can see the Account Code of New Journal entry and other properties, why it should set the account code again, even set the Account Code to itself account code, it works, otherwise it doesn't work.

Thanks,

Kathy