I want to give an error message when trying to post if either line and voucher narration is blank
till now I have written this code by which if either of the narration is present then it is posting (GenJr is the record variable of table for line narration and voucher narration page as both of them go to same table)
GenJr.RESET;
IF GenJr.FINDSET THEN REPEAT
GenJr.SETRANGE(GenJr."Journal Template Name","Journal Template Name");
GenJr.SETRANGE(GenJr."Journal Batch Name" ,"Journal Batch Name");
//GenJr.SETRANGE(GenJr."Gen. Journal Line No.","Line No.");
CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post",Rec);
CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");
CurrPage.UPDATE(FALSE)
UNTIL NEXT=0
ELSE ERROR('A');
is there any way I can access line narration page narration field in bank payment voucher page?
0
Answers
Can you explain a bit more, I don't see in your question what you mean by Voucher Line and Voucher Narration and their relation. (and I cannot find those in my database).
What I do know is that you should SETRANGE first and then use FINDSET.
And if you do [GenJr.FINDSET THEN REPEAT] then you should do [UNTIL GenJr.NEXT=0].
And you can not access fields in another Page. (that is what I know.)
And this is the classic client section
Good luck.
I believe the first thing needed is to rearrange the codes. After Reset of the Record variable you need to do SETRANGE then FINDSET is written. In codeunit.Run you are passing Rec as parameter but I think you need to pass Genjr.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/