Robert wrote: > > Hi, all. > > I need you to help me, please > I'm programming in MapBasic and I have trouble doing some procedures. > For example I have the nex table > > Table One.tab with the next fields > Table One.tab > A1 B1 C1 D1 > A1 B2 C2 D2 > A3 B3 C3 D3 > > Browse this table without problems, but I need to know, How to do in = > order to know if this table is OPEN or not?, afterthat to close it. If you know the name of a table, you can check to see if it's open with a function like the following: Function IsTableOpened ( ByVal sTab As String) 'Name of (possibly) open table as logical 'TRUE is table is open dim i as smallint OnError goto Trap i = TableInfo (sTab, TAB_INFO_NUM) IsTableOpened = TRUE exit function Trap: IsTableOpened = FALSE End Function This simply sets up a trap routine to catch errors, and then tries to execute TableInfo(). We don't even care what the result is; just did it work or not? If it works, the table is open and IsTableOpened() returns TRUE. If the table is not open, then TableInfo() generates a runtime error, and the error trap routine returns FALSE. You can get more elaborate (like suppose the table is open but not with the name you think it has, or perhaps you need to check only for tables with four columns named A1, B1, C1, D1), but this is a quick and general method to see if a table is open providing you the table name. -- - Bill Thoen ------------------------------------------------------------ GISnet, 1401 Walnut St., Suite C, Boulder, CO 80302 tel: 303-786-9961, fax: 303-443-4856 mailto:[EMAIL PROTECTED], http://www.gisnet.com ------------------------------------------------------------ _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.