Close Table statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Closes an open table. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Close Table table [ Interactive ]

table is the name of a table that is open

Description

The Close Table statement closes an open table. To close all tables, use the Close All statement.

If a table is displayed in one or more Grapher or Browser windows, those windows disappear automatically when the table is closed. If the Close Table statement closes the only table in a Map window, the window closes. If you use the Close Table statement to close a linked table that has edits pending, MapInfo Pro keeps the edits pending until a later session.

Saving Edits

If you omit the optional Interactive keyword, MapBasic closes the table regardless of whether the table has unsaved edits; any unsaved edits are discarded. If you include the Interactive keyword, and if the table has unsaved edits, MapBasic displays a dialog box allowing the user to save or discard the edits or cancel the close operation.

To guarantee that pending edits are discarded, omit the Interactive keyword or issue a Rollback statement before calling Close Table. To guarantee that pending edits are saved, issue a Commit Table statement before the Close Table statement. To determine whether a table has unsaved edits, call the TableInfo() function( table, TAB_INFO_EDITED) function.

Saving Themes and Cosmetic Objects

When you close the last table in a Map window, the window closes. However, the user may want to save thematic layers or cosmetic objects before closing the window. To prompt the user to save themes or cosmetic objects, include the Interactive keyword.

If you omit the Interactive keyword, the Close Table statement will not prompt the user to save themes or cosmetic objects. If you include the Interactive keyword, dialog boxes will prompt the user to save themes and/or cosmetic objects, if such prompts are appropriate. (The user is not prompted if the window has no themes or cosmetic objects.)

Examples

Open Table "world" 
' ... when done using the WORLD table,
' close it by saying: 
Close Table world

To deselect the selected rows, close the Selection table.

Close Table Selection

See Also:

Close All statement, Commit Table statement, Open Table statement, Rollback statement, TableInfo() function