Hi Peter,
I think there are numerous examples to be found on the Net of
functions to check whether a table is open or not.
Below I will give one of these. In the example you give you force an
error (from the TableInfo function) to establish that the table is not
open. In the example below the string given is compared with the names
of all the open tables; and maybe that's more elegant :-)
Declare Function TableIsOpen
(ByVal sTabName As String)
As Logical
'*************************************************
Function TableIsOpen (
ByVal sTabName As String)
As Logical
Dim iCounter, iNumberOfTables As Integer
iNumberOfTables = NumTables()
If iNumberOfTables = 0 Then
Goto no_tables_open
End If
For iCounter = 1 to iNumberOfTables
If TableInfo(iCounter, TAB_INFO_NAME) = sTabName
Then
TableIsOpen = TRUE
Exit Function
End If
Next
no_tables_open:
TableIsOpen = FALSE
End Function
'*************************************************
Cheers,
Egge-Jan