Objective 1.4 Protect and maintain databases

  • 1.4.1 Compact and repair databases
  • 1.4.2 Back up and restore databases
  • 1.4.3 Split a database
  • 1.4.4 Encrypt database files

OBJECTIVE 1.4: Contents

1.4.1 Compact and repair databases

As you and other users work with an Access database, the database file grows larger as you add data and because Access creates and uses hidden objects to perform its work behind the scenes. Database files can also become corrupt. Frequent use of the database—especially by multiple users working on the database over a network—can result in a corrupted file, which can in some cases result in data loss or affect the ease with which you can change the database’s design.

To keep ahead of these potential problems, you can compact and repair a database. You can perform these operations on the current database (the database you have open) or select a different database when you perform these operations.

Some restrictions apply to compacting and repairing a database. For example, if more than one person has the database open when you compact or repair it, Access displays a message indicating that you attempted to open a database that is already open. Before you compact a multiuser database, you should be sure that no one has the database open and then open the database for exclusive access.

Tip: Select the Compact On Close option on the Current Database page of the Access Options dialog box to compact a database each time you close it.


To open a database for exclusive access

1. If the database is open, click the File tab, and then click Close. (If other users have the database open, they must also close the database.)

2. Display the Open page of the Backstage view. In the Places list, click the location where the database is stored, such as This PC. Then click Browse.

3. In the Open dialog box, navigate to the folder where the database is stored, and then select the database.

4. Click the Open arrow, and then click Open Exclusive.

Screenshot of the Open dialog box with the Open Exclusive option selected.

Opening a database for exclusive access


To compact and repair the current database

1. Open the database for exclusive access.

2. On the Info page of the Backstage view, click Compact & Repair Database.


To compact and repair a database that isn’t currently open

1. Close any open databases.

2. On the Database Tools tab, in the Tools group, click Compact and Repair Database.

3. In the Database to Compact From dialog box, select the database you want to compact, and then click Compact.

4. In the Compact Database Into dialog box, enter a name for the compacted database, and then click Save.

5. If you used the current name of the database, click Yes in the message box Access displays to confirm that Access should replace the current database file.