I dunno... maybe it's just me getting cross-eyed trying to follow the logic... but if your indenting is true to form, the following have only a single CASE:
Case $sLocation >= "0002" AND $sLocation <= "0999"
Case InStr('NLRHEKSV',$sFunction)

I take back the ELSE part.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.