Don't Preview if the total is not balance


I am putting a code in action under General Journal page., I wrote:

IF GenJnlLine.“Debit Amount” = GenJnlLine.“Credit Amount” THEN



GenJnlLine.“Debit Amount” <> GenJnlLine.“Credit Amount” THEN



Is this right? the case is it will not allow to preview report if the total in Journal Voucher is not balance.

can you be more clear?\

what do you want to do when amounts are equal and not…


Did tis code work in Page Action?

Currreport.Preview will not work in page.

Well.,Ideleted the first code that I made, and declared a function in Globals. “ValidateBalance();”

Then added this code to that function:

IF TotalBalance+“Balance (LCY)”-xRec.“Balance (LCY)” <> 0.0 THEN

ERROR(“Journal Batch Name”, TotalBalance+“Balance (LCY)”-xRec.“Balance (LCY)”);

As I run the report in R2, the error message says The Batch name only.

I am trying to show the error message “Jornal Batch “NAME” is out of balance by “value”” in R2

but it’s not succesfull

Check Codeunit 80 how textconstants are used to show error messages…