"Save Workspace As" Bug
The Save Workspace As command fails if there is a query to store in the workspace. (MapInfo bug #11300.)
If you execute the Save Workspace As filename.WOR statement and there is a query to be saved and the preference to save queries in workspaces is set to on, the error message "Unable to save workspace" will appear and your program will crash. This bug exsists in MapBasic version 5.5 through 8.0.
Example:
Dim sWorfile as StringThe workaround is to execute the command with the Run Command statement:Open Table "States.TAB" Interactive Select * from States Where CentroidX(obj) < -96.0 Into WesternStates Map from WesternStates sWorfile = FileSaveAsFlg ("", "*.WOR", "WOR", "Save wworkspace as:")
Save Workspace As sWorfile
Dim sWorfile as String Dim sCmd as StringOpen Table "States.TAB" Interactive Select * from States Where CentroidX(obj) < -96.0 Into WesternStates Map from WesternStates sWorfile = FileSaveAsFlg ("", "*.WOR", "WOR", "Save wworkspace as:")
sCmd = "Save Workspace As """ + sWorfile + """" Run Command sCmd