You seem to have two tables: POS and Assigncustomername.
Is there any relationship defined between these two tables?
Do you want all records in POS that match a record in Assigncustomername?
Or do you want all records in POS that match a record selected by the user from AssignCustomerName?
On a side note, what will you do if you have two customers with exactly the same customer name?
I had completed the function. share the code.
Does it work for you?
Show All Records
Show Omitted Only
Isolates the current record into a found set of just that one record.
Thus your loop will only execute a single time as the "exit after last" clause in go to record will exit the loop the first time it executes. The Set varialbe, go to layout and extend found set steps will never execute as the loop will always exit before it can get to them.
I'd suggest an alternate script, but am still waiting for you to answer my questions as to what you want the script to do.