The following code will tell you if a table is open, either on another computer or the same computer that is running the code:
Code:
lnError = 0
TRY
USE MyTable IN 0 EXCLUSIVE
CATCH TO loError
lnError = loError.ErrorNo
ENDTRY
USE IN SELECT("MyTable")
IF lnError = 1705
? "Table is already open"
ENDIF
This is not perfect. It only tells you that the operating system is denying access to the physical file. It could mean that the file is read-only, for example. Also, even if the file is not opened on another computer at the time you execute this code, it doesn't mean that will still be the case when you actually open the table.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.