Are you sure Wyse 3000 terminals have %clientname% set. Without knowing what the clientnames are it is hard to test your code.

Have you tried with debug on to see what the InStr() functions return?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.