Remeber when closing a table you might actually close more than one !!
So your loop should count down from the number of open tables to 1:
If NumTables() > 0 Then
for i = NumTables() to 1 Step -1
Close Table TableInfo(NumTables(), TAB_INFO_NAME)
next
End If
HTH,
Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
Tel +45 6311 4900
Direct +45 6311 4908
Mob +45 5156 1045
Fax +45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk/gis
-----Original Message-----
From: Bill Thoen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 26, 2004 7:03 PM
To: Lukas, Paul
Cc: '[EMAIL PROTECTED]'
Subject: Re: MI-L Cannot Close Table Error
You'd probably be better off to simply issue a 'Close All' staement.
That's faster, too.
On Tue, 26 Oct 2004, Lukas, Paul wrote:
>
> > One of my users gets this error on occasion (it doesn't happen all
> > the
> > time) in a MapBasic application I created..
> >
> > We are using MapInfo 7.8 on Win2000 computers SP3.
> >
> > The application is trying to close all open tables, but sometimes,
> > and I can't track down the circumstances, he gets the error:
> >
> > "Cannot find Table 1"
> >
> > Here is the code:
> > numtabs = numtables()
> > if numtabs > 0 then
> > for i = 1 to numtabs
> > tabname = tableinfo(1, TAB_INFO_NAME)
> > close table tabname
> > next
> > end if
> >
> > I figure if there is a table open, there will always be a "table 1".
> > I cannot figure out why this error is occuring, and why it only
> > happens every once in a while. Any ideas?
> >
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> Message number: 13830
>
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13831
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13834