If you close the table your temp tables are based on, then they
automatically get closed as well. To select only the temporary
tables, you should add the line:
if TableInfo (intI, TAB_INFO_TEMP) then
'close it
Another thing to watch out for when deleting or closing tables,
or points, or any other collections of things in MapInfo (and
other software), is that when the number of items is constantly
diminishing, the upper end of your For... Next is going to be out
of range sooner or later. When removing items, you should reverse
the count going from highest to lowest, e.g.
For intI = intNumTable to 1 step -1
That way if you have say, 5 open tables and you close 3, your
application won't cough up its socks when it tries to access
table TableInfo (3, TAB_INFO_NAME)
Chris Stephen wrote:
> G'Day Listers,
>
> Below is a small bit of MB that is frustratingly failing.
> Having created two temporary tables and then inserted values
> into them, all
> I want to do is close them (and discard the updates) at the end
> of my
> process.
> The error returned (seen below) says that the last created
> table cannot be
> found - ERR_TABLE_NOT_FOUND, however the table exists as can be
> seen from
> the Print statement.
> I thought perhaps the table had updates pending, hence my use
> of the Commit
> statement, but still no joy.
>
> I'd love to hear what anyone has to say about what MapInfo is
> doing with my
> table!
>
> intNumTables = NumTables()
> If intNumTables > 0 Then
> For intI = 1 To intNumTables
> strTabName = TableInfo(intI, TAB_INFO_NAME)
> Print TableInfo(intI, TAB_INFO_NUM) + " : " +
> strTabName *
> If Left$(strTabName,3) = "tmp" Then
> Commit Table strTabName
> Close Table strTabName **
> End If
> Next
> End If
>
> * correctly displays (for example)
> 1 : Roads
> 2 : tmpTable1 temp tables created
> 3 : tmpTable2 at beginning of application.
>
> ** Error# and description returned - "405:Table 3 not found."
>
> TIA
> Christopher Stephen.
>
>
>
>-------------------------------------------------------------------------------------------------------------
>
>
>
>
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]