Another consideration is to add more robust error handling code to your error handler.
Assumptions: lcDBF is target table, lcAlias is intended alias
Trap for the "Table In Use" error and then look to see if alias is open. If it is then USE IN (lcAlias) and then RETRY. Otherwise you can scan the open aliases to see if any DBF() = lcDBF. Close that table and then RETRY.
HTH
I try to stay online, to get better information.
I try to get away from the office once in a while..
But they KEEP... PULLING.. ME.. BACK.. IN!!!