select Invoice &&table scan select temptable &&cursor locate for temptable.invoice_no=invoice.invoice_no if found() replace invoice.invoice_no with temptable.invoice_no else delete <b> Which table is selected here?</b> endif endscanThat being said, perhaps what you want is a parameterized view of the table, set to table buffering. Then add, update, or delete records that you see in the view, and do a TABLEUPDATE() to get all the changes back to the base table.
select Invoice &&table > go top > scan > select temptable &&cursor > locate for temptable.invoice_no=invoice.invoice_no > if found() > replace invoice.invoice_no with temptable.invoice_no > else > delete > endif > endscan>