Randy: This is a bug in MapInfo. You should be able to use an OnError statement to get around the error. Cindy MapInfo Technical Support * To: TechSupport/MapInfo Corp, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> cc: Subject: MapBasic EndHandler problems I have some MapBasic code which contains an EndHandler routine which performs some scrap-file cleanup. It works fine with any number of tables/configurations open, EXCEPT when I have a table open that is the results of a SQL grouped-by function (eg Query1 is a grouped-by table based on a SQL query of a base table). In that scenario, when the program is ended or I exit MapInfo, the end handler produces an error of: File #0 not registered for access. Here's the code: (I'm thinking the line containing TAB_TYPE_BASE should keep it from trying to evaluate the SQL grouped-by tables, but maybe not...) ' Sub EndHandler DIM i as Integer '...the current table in the loop of NumTables() For i = NumTables() to 1 Step -1 If TableInfo(i, TAB_INFO_TYPE) = TAB_TYPE_BASE then If ((Left$(PathToFileName$(TableInfo(i,TAB_INFO_TABFILE)),1) = "_" or Left$(PathToFileName$(TableInfo(i,TAB_INFO_TABFILE)),1) = "~" )) and PathToDirectory$(TableInfo(i,TAB_INFO_TABFILE)) = PathToDirectory$(TempFileName$("")) then Drop Table TableInfo(i,TAB_INFO_NAME) End If End If Next End Sub ' Any help much appreciated. Randy Majors - Manager, GIS & Mapping Resource Data International 303-444-7788 <http://www.resdata.com <http://www.resdata.com> > http://www.resdata.com <http://www.resdata.com> - <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > [EMAIL PROTECTED] <mailto:[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]
