Hi Kingston

Try running the script in debug mode to Check the value of $what_rm

;************
$wksta=@wksta
$a=substr($wksta,5,2) ;take last two char
$what_rm=val($a) ;change to number

$what_rm


Good luck
Rgds
Don