Updating TempDB table

I followed this thread how to update a temporary table? however I got an error “Cannot edit a record in TableName.
The record has never been selected”.

Any wrong with the code below?

    tmpCheckVoucher.setTmpData(report);
    ttsBegin;
    while select * from tblTransaction
        where tblTransaction.TranId == KeyId
    {

        select forupdate tmpCheckVoucher where tmpCheckVoucher.LedgerAccount == tblTransaction.accountDisplay();

        tmpCheckVoucher.Field1      = enum2str(tblTransaction.AccountType);
        tmpCheckVoucher.Field2      = tblTransaction.accountDisplay();
        tmpCheckVoucher.Field3      = tblTransaction.accountName();
        tmpCheckVoucher.doUpdate();
    }
    ttsCommit;

What is the point in calling an update on a temporary table/ record? It will never be saved to the database anyway.

.update() is called to save changes to database.

It seems the record which you are selecting for update is not exist. Debug and check whether record exists in all the cases.