Example: Closing without Saving

This example shows how using File - Close without saving a project can affect local tables and components differently from those saved already into a data source, such as a linked database.

 

If a project has only local components then closing it without saving changes made will leave the original .map project file unchanged.    However, if we have linked in data sources and we have made any changes to those data sources, in general those changes will have been committed to those data sources at the time we made the changes.   Closing the project without saving will not "undo" changes already made to external data sources.    

 

In this example we create a data source using a Microsoft Access .mdb file database.  

 

Manifold uses Microsoft facilities to work with Microsoft .mdb files.   If Manifold cannot import from, link to, or export to an .mdb file, that means the Windows system we are using is missing the necessary facilities.  Please see the Microsoft Office Formats - MDB, XLS and Friends topic for a solution.  This example uses 64-bit Windows 11 with Microsoft's 64-bit Access Database Engine installed.

 

Link an MDB

 

Launch Manifold and in the main menu choose File - Create - New Data Source.

 

 

Choose More... to launch the New Data Source dialog.

 

 

We specify a Name of books.mdb, choose a Type of File: mdb and then use the browse [...] button to browse over to a Source of C:\Data\books.mdb.  The .mdb file is a Microsoft Access .mdb file database that contains tables, queries and examples for Chris Fehily's fine books on SQL, which are highly recommended by Manifold for anyone new to SQL.   

 

Press Create Data Source and a new data source is added to the project.

 

If a new data source for the .mdb is not created as shown below, that means the Windows system we are using is missing facilities necessary for a connection to .mdb. Please see the Microsoft Office Formats - MDB, XLS and Friends topic for a solution.

 

 

 

 

We expand the books.mdb data source and then double-click on the authors table to open it.

 

 

 

 

Click on the authors table to highlight it in the Project pane and then press the Copy icon in the Project pane toolbar.

 

 

 

 

We close the books mdb data source to provide more free space in the Project pane.   

 

Click anywhere in the "white space" of the Project pane and press on the Paste icon in the Project pane toolbar.

 

 

 

 

We have just created a copy of the authors table that is in the .mdb file database, with the copy being created as a local table within the project.

 

 

 

 

We will now use File - Save As to save the project.

 

 

 

 

We save the project using the name books with mdb as the name for our .map project file.

Modify Tables

Next, we will modify the tables in the project, beginning with the authors table that is inside the books mdb data source, that is, within the .mdb file database to which that data source is linked.

 

We double-click into the au_fname field for the last record to edit it, change the name from Paddy to Sean, and then commit the edit by pressing Enter and then Ctrl-Enter.

 

 

 

 

We have just changed the record within the .mdb file database.   We will now edit the local copy that we made of that table.   We double-click the authors table in the Project pane.

 

 

 

 

We can see that obviously it is indeed a copy of the authors table in the .mdb file database.   Note that when multiple window are open in the Manifold desktop we can tell which is which by the names on their tabs.   The authors : books mdb tab is for the authors table that resides in the books mdb data source while the authors tab is for the local authors table that resides in the project.

 

We edit the same field in the local authors table to change the name from Paddy to James.

 

 

 

 

We will now Close the project without saving it.

 

 

 

 

When we issue a File - Close command Manifold knows the project has changed but has not been saved since changes were made so Manifold will ask us if we want to save changes.

 

 

We Press No.   This will close the project and will not update the books with mdb.map  file that was last saved.

 

 

 

 

Let us now Open the books with mdb.map project file we previously saved.

 

 

 

 

When the project opens we see it still has as expected both the books mdb data source as well as the authors local table we created by copying and pasting a table from the data source.   

 

 

 

 

If we double-click on the local authors table to open it we see that the edit we made to that table, to change the name in the last record from Paddy to James, has disappeared.   That is because the last time we saved this project was before the edit so what we see in the local table is how it appeared at the time we saved the project but before we changed the name.

 

 

 

 

In contrast, if we drill down into the books mdb data source and open the authors table within the .mdb file database, we can see that the edit we made to that table, changing the name from Paddy to Sean, has not disappeared.   The name has indeed been changed.   

 

 

 

 

We might find that unexpected given that we made the change from Paddy to Sean after we saved the project.

 

In the case of the data source connected to the .mdb file database, it doesn't matter that we made the edit after we saved the project because the data source is a live, dynamic connection to the .mdb file database.   If we change a record in an .mdb file database the changes take immediate effect, as changes to records do with almost every database.    The moment we committed our change of Paddy to Sean by pressing Ctrl-Enter that change was propagated into and committed to the .mdb file database which the books mdb data source represents.

 

When we use File - Save or File - Save As to save the project to a .map project file, we are saving data that is stored within the project and we are storing housekeeping information, such as connection strings, required to reconnect to any data sources that have been created in the project.   Any changes to data within data sources typically have already been made whether or not we save the project.  If we close the project without saving it, those changes which have already been made to an external data source will not be undone

 

See Also

Getting Started - For a discussion of importing compared to linking and where data is stored.

 

File - Create - New Data Source

 

File - New / Open / Close / Save / Save As

 

MDB Microsoft Access

 

Example: Create and Use New Data Source using an MDB Database - This example Illustrates the step-by-step creation of a new data source using an .mdb file database, followed by use of SQL.  Although now deprecated in favor of the more current Access Database Engine formats, .mdb files are ubiquitous in the Microsoft world, one of the more popular file formats in which file databases are encountered.  

 

Example: Switching between Manifold and Native Query Engines - How to use the !manifold and !native commands to switch a query in the Command window from use the Manifold query engine to whatever query engine is provided by a data source.

 

Microsoft Office Formats - MDB, XLS and Friends