CJ, sorry I should have noted what line was causing the error
, kix errors out on this line$nul = execute('use $a "$b" exit(@@error)')
in the function version of the code. (I edited my post to indicate this)
and $tab is a global var that is being set at the start of the code.. 
Bryce
------------------
kix.isorg.net