How to get check ledger entry related to a general journal line?

I need to get a check ledger entry related to a general journal line and set it Entry status to ‘Printed’.

Below is my code. I always get ‘not found’ message.

checkLedgerEntryRec.SetRange("Document No.", GenJournalLine."Document No.");
checkLedgerEntryRec.SetRange("Document Type", checkLedgerEntryRec."Document Type"::Payment);
if (checkLedgerEntryRec.FindFirst()) then begin
    Message('found');
    checkLedgerEntryRec."Entry Status" := checkLedgerEntryRec."Entry Status"::Printed;
    checkLedgerEntryRec.Modify();
end
else
    Message('not found');

What is wrong with my code?

You might need to further filter. This is an example of an action I created in the “Payments Journal”, where Rec is the GenJournalLine:

ViewCheckLedgerEntries - OnAction()
IF Rec.“Bal. Account Type” <> Rec.“Bal. Account Type”::“Bank Account” THEN
ERROR(BalancingAccountNotBank);
CheckLedgerEntry.RESET;
CheckLedgerEntry.SETRANGE(“Posting Date”,Rec.“Posting Date”);
CheckLedgerEntry.SETRANGE(“Document No.”,Rec.“Document No.”);
CheckLedgerEntry.SETRANGE(“External Document No.”,Rec.“External Document No.”);
CheckLedgerEntry.SETRANGE(“Bank Account No.”,Rec.“Bal. Account No.”);
CheckLedgerEntries.SETTABLEVIEW(CheckLedgerEntry);
CheckLedgerEntries.RUNMODAL;