>>>Thanks, Tore. Perhaps this may be one of the problems here, which we may want to eliminate. Although it's a bit tricky given that lengthy code.
>>
>>I hope you use Thor? One of the Thor tools will give you a list of the places where you have a Return within a With-Endwith construct. It can even fix it for you.
>
>"Fix it for you"? Since multiple RETURNs is one sign of spaghetti logic, how can Thor "fix" it in the general case?
I guess it would create a local variable, set it to .t., then wrap the rest of the with-endwith block in if ThisLocalVar...endif, then the rest of the code in the procedure in another such if-endif block... and so on until out of any if, scan, for and other blocks/loops, so the code swims out executing nothing else.
If there's spaghetti in there before this is done, it would now also have sticky stringy cheese too.