Hi Daniel I think the problem is that the number of tables changes when you close one.
The following will be invalid when i > NumTables() tableInfo(i,TAB_INFO_NUM) You need to re-think how your loop works. Regards Matt PS I apologise for the previous empty message. Matthew Trigg Database Manager GEOGRAPHERS' A-Z MAP CO. LTD. -----Original Message----- From: Daniel York [mailto:[EMAIL PROTECTED] Sent: 12 July 2004 09:42 To: [EMAIL PROTECTED] Subject: MI-L DEBUG problem Good Morning I have written the following code to determine if a tablename is the result of a query and if it is to remove it. The code seems to work but after four or five loops it causes an error. I have tried to use error handlers but cannot see the problem. Can anybody offer any advice. Thanks in advance include "mapbasic.def" Declare Sub Close_Query Declare Sub Main Sub Main Call Close_Query End Sub Sub Close_Query Dim sLaynum as smallint Dim Total_Layers as Integer, I as Integer Dim Prt_Name as String Dim sLayname as String Total_Layers = NumTables() for I = 1 to Total_Layers note I sLayNum = tableInfo(i,TAB_INFO_NUM) ONERROR GOTO SKIP sLayName = tableInfo(sLayNum,TAB_INFO_NAME) note sLayNum Prt_Name = mid$(sLayname,1,5) If Prt_Name = "Query" Then Close Table slayname Interactive End If SKIP: Next End Sub Daniel York MapInfo Specialist Information Team Corporate Development South Tyneside Council Town Hall and Civic Offices Westoe Road South Shields Tyne & Wear NE33 2RL 0191 4247558 **************************************************************************** ******************** Please do not print this e-mail if you can help it - and help protect the environment. **************************************************************************** ******************** This Message may contain confidential information and is protected by copyright. If you receive it in error please notify us and delete it without making use of or copying it. The addressee and other employees within the Council may read and copy any e-mail reply to this message and other e-mails you send to us. Whilst we use virus checking procedures we accept no liability for viruses and recipients must rely on their own virus checking procedures. **************************************************************************** ******************** The Council's web site address is www.southtyneside.info South Tyneside Business Week 7-13th July 2004, Bents Park, South Shields www.southtyneside.info/businessweek --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 12547 -------------------------------------------------------------------------------------- 1. This message and any files or other attachments transmitted with it is intended for the addressee only. They are private and confidential and are for the sole use of the intended recipient. Copyright in this message and any accompanying document created by us is owned by us. If you are not the intended recipient of this e-mail or any part of it please telephone Head Office at the number shown below or notify us by e-mail at: [EMAIL PROTECTED] You should not use or disclose to any other person the contents of this message or its attachments or files (if any), nor take copies. 2. We have taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses, but we cannot accept any liability for any loss or damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any attachment or file. Please note as well that e-mails can be falsified: in circumstances where the content of this e-mail is important you should not rely on its integrity without checking it by telephone or fax. 3. This message and any files or attachments have been sent to you with the sender's knowledge that the contents may be intercepted, monitored and regulated by us in the course of transmission and in compliance with the Regulation of Investigatory Powers Act 2000. If you reply to this message and/or send a message to us in any other way you accept that the contents, including attachments or files, of that message may be intercepted, monitored and regulated by us in the course of transmission and in compliance with the Regulation of Investigatory Powers Act 2000. If for any reason you do not wish to consent to the above please contact us on the number below. GEOGRAPHERS' A-Z MAP COMPANY LIMITED Fairfield Road Borough Green Sevenoaks Kent TN15 8PP Telephone: 01732 781000 Fax: 01732 780677 -------------------------------------------------------------------------------------- --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 12558
