One cannot expect users to enter information correctly. That should be done by an admin.

Picking apart your code a bit...

KiX is not case sensitive so I wonder why you force UCASE and then use a case sensitive ==?
Ucase($User.sAMAccountName) == Ucase(@USERID)

Rather that loop through all the users in a FOR loop, translate the name with the TranslateName() UDF, and then use the DN in a direct LDAP operation.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.