>IF USED('mytable') > USE IN mytable >ENDIF >Or, as an one-liner:
use in select("mytable")The nice part here is that select("tablenotinuse") will return a zero; Use in 0 then does nothing - closes the table which is open in first free workarea, and "free workarea" is the one with no table open in it :). One nice thing with VFP is that closing a table in such a workarea does nothing, gives no error, and I think it was so ever since dBase III (or maybe IIa).