I know there is a way to do this, but maybe someone can remind me of what command I use to see if a table is open and what cursors are in use. I tried used("table"), but it did not appear to work.
I know there is a way to do this, but maybe someone can remind me of what command I use to see if a table is open and what cursors are in use. I tried used("table"), but it did not appear to work.
Hi Rdd,
Yes, USED("alias-name" | cursor-number), specifying the alias name or the cursor/workarea number - returns .T. or .F.
Also INUSE("alias-name") - returns .T. or .F.
Or SELECT("alias-name") - returns 0 or the cursor/workarea number if open.
Did USED() return an error or just not the result you were expecting?
Regards,
Yvonne
rdd,
You should be able to use the Used() or the Inuse() functions to determine if a given table is open in any work area.
One thing to note is that both functions accept an alias parameter rather than a table name so both used("employees") and inuse("employees") should return .T. if there is a table open with the alias "employees" in any work area.
As far as I can see, the only difference between the two functions is that you can run used() without passing a parameter and it will return .T. if any table is open in the current work area. If you run inuse() without a parameter it will generate an error.
So...
Cheers,close all
select 1
use southwindw!employees
?used() returns .T.
?used("employees") returns .T.
?inuse("employees") returns .T.
select 2
?used() returns .F.
?used("employees") returns .T.
?inuse("employees") returns .T.
?used("company ") returns .F.
close all
select 1
use southwindw!employees alias test1
?used() returns .T.
?used("employees") returns .F.
?inuse("employees") returns .F.
?used("test" returns .T.
?inuse("test") returns .T.
Rob C
Thanks Guys, great information. I figured it was something simple. I was forgetting the ? in front of the command.
Bookmarks