USE mytable ALIAS someother ? USED('mytable') &&returns .F. =aUSED(aTables) ? aTables(1,1) &&returns SOMEOTHER, not mytableThen you'd need to use the DBF() function to iterate through looking for an alias with the correct underlying table. Seems like a lot of work.
Local llMyAliasOpen Select 0 llMyAliasOpen=.F. Try Use mytable Again Alias myalias Catch *---myalias is open now one way or another... *---flag this so it doesn't get closed at end of routine llMyAliasOpen=.T. FinallyYou have to use ALIAS or it will reopen the table with A, B. C... aliases. You can open it ALIAS mytable if you want to use the tablename. It would be much more complex if you want to use any existing alias for that table that may happen to be open, but that's time for a redesign IMHO.