Hi Tony,

If you do not have too many tables open, and do not check often, try a loop
querying all open tables.  This one below should work.  If you want to check
'QUERYn' Tables, replace the TableInfo with Left$(....,5) = "Query"

I use a similar function to remove several tables I constantly open and
close.

Mark
****************************************************************************
******************
Function IsTableOpen(szMyTableName As String) As Logical
Dim snNumTables, snLoop As SmallInt
Dim bBoolCheck As Logical

        bBoolCheck = 0
        snNumTables = NumTables()
        If snNumTables > 1 Then
                For snLoop = 1 to snNumTables
                        If TableInfo( snLoop, TAB_INFO_NAME) = szMyTableName
Then
                                bBoolCheck = 1
                        End If
                Next
        End If

        IsTableOpen = bBoolCheck
End Function
****************************************************************************
******************


-----Original Message-----
From: Tony Kelava [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 16, 2000 4:24 PM
To: [EMAIL PROTECTED]
Subject: MI Tables


How do tell if a table is open in mapbasic?

I've tried 

 x = TableInfo (tablename , TAB_INFO_NROWS)

but if the table is not open, this halts the mapbasic program, so i tried
this:

onerror goto NotOpen
 x = TableInfo (tablename , TAB_INFO_NROWS)
NotOpen:

BUT, it still halts the program if the table is not open. OnError doesn't
seem to be trapping all errors. 

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to