--HM
Trimming isn't rushmore optimizable - padding out the literl value is. Trimming isn't reliable either - you can end up with multiple values that match the trimmed values.
+++ Rick ---
Why add padding to the user name var rather than trimming space from both values?
LOCATE FOR UserName=PADR(lcUserId, LEN(UserName)) and ...
--Harvey