Hello Paul, It might be better practice, and solve your error, if you didn't react to the table not being open in the error handler. I'm not aware of any problems with loading up the error handler in this way but it's easy to get into a situation where your error handler needs an error handler, etc. Perhaps that would be best checked for and dealt with in the main body of the sub/function? Below is some code for a IsTabOpen() function.
Regards, Warren Vick Europa Technologies Ltd. http://www.europa-tech.com function IsTabOpen(byval TabName as string) as logical dim Check as logical Check = FALSE onerror goto ErrHandler if TableInfo(TabName, TAB_INFO_NAME) <> "" then Check = TRUE end if SkipTest: IsTabOpen = Check onerror goto 0 exit function ErrHandler: resume SkipTest end function -----Original Message----- From: Lukas, Paul [mailto:[EMAIL PROTECTED] Sent: 23 November 2004 19:54 To: '[EMAIL PROTECTED]' Subject: MI-L trouble opening a Table from MapBasic I'm stumped here. I hope somebody can see something I'm not... I'm running a command to grab some metadata from a table - however, if that table is not open, I use the onerror command to go open the missing table. However, that table is never opened, and the error still comes through. Here is the code...(I'm working with predefined table names - every table used by this application was created by the application, so FDA_Boundary is an actual table name...) onerror goto missing_file gg_workordernum = getmetadata$(fda_boundary, "\wo") the error code is: missing_file: if ask ("The table ""FDA_Boundary"" is not open in MapInfo. The table must be open to add a new FDA Boundary. Do you wish to open it?", "Yes", "No") then gg_curr_tab = fileopendlg(gg_file_dir, "FDA_Boundary", "TAB", "Open FDA_Boundary File") if gg_curr_tab = "" then exit sub else open table gg_curr_tab resume 0 end if end if If I click "no" from the ask dialog, everything resumes normally, and I successfully recover from the error. The same if I click cancel from the file open dialog. However, after selecting the correct file from the file open dialog and clicking "OK", I still get the error that "Variable or field FDA_Boundary not defined" because the table was not opened in MapInfo. Can anybody see what I'm missing, or maybe a better way to do this? Maybe I've just been working on this application for too long. Paul Lukas --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 14192 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 14193
