>>there is the danger that another will grab the file in the small time window between the fclose & the use & there's no guarantee that the -1 return is due to the file already being open - it may not exist for example, but extra code code be put in to test these conditions if required.
Here's a way to do this without having to use FOPEN. It actually uses the USe command so there is no danger of someone else grabbing the file before you. You can make changes to allow alias, workarea, again, etc.
FUNCTION MyUse
LPARAMETER lcTableName
LOCAL lcErrorProc,nErrorNum
** Store the old ON ERROR code
lcErrorProc = ON('Error')
** This is the success value
nErrorNum = 0
** Note that we pass the nErrorNum by reference so our
** on error proc can change it
ON ERROR DO NotOpen WITH Error(),nErrorNum
** Try opeing the table
USE &lcTableName
** Reset the error proc
ON ERROR &lcErrorProc
RETURN nErrorNum
FUNCTION NotOpen
LPARAMETER nErrorCode,nErrorNum
nErrorNum = nErrorCode
RETURN