Home

Microsoft Access Database

 

Introduction

A Microsoft Access database is primarily a Windows file. It must have a location, also called a path, which indicates how the file can be retrieved and made available. Although you can create a database on the root directory such as the C: drive, it is usually a good idea to create your files, including your databases, in an easily recognizable folder.

When you installed the computer (or when it was installed), it (the operating system) might have created a folder called My Documents that provides a convenient place for you to create your files. If various people use the same computer, there is a different My Documents folder for each one. When you log in, the computer (the operating system) locates your corresponding My Documents folder and makes it available.

Creating a Database

In our lessons, we will learn different techniques of creating a database. For now, a database is first of all a Windows file. It is mainly created from Microsoft Access. If you have just started Microsoft Access, to create a database, you can use one of the links in the main (middle section of the interface).

You can proceed from one of these options. Like every file in the computer, a database must have a name that identifies it. This name must be specified when creating the database.

In our description of the Microsoft Access interface, we saw that the right section displayed an empty area. If you start creating a database as we will see in the next sections and lessons, the right side gets filled with some options, such as prompting you to name your database.

The Database Wizard

Many techniques allow you to create a database, the fastest of which consists of using one of the provided templates. To create a database using one of the samples, in the left section, first click Local Templates, then, in the main section, select one of the samples under Local Templates:

Local Templates

The templates are organized in categories. To access a sample by category, in the left section, you can click Business, Personal, or Education. When you click a category, its templates display under Local Templates and you can choose one. After selecting a template, in the right section, you must give a name to your new database in the File Name text box. By default, Microsoft Access suggests a name you can use. If you do not like it, you can provide your own. Also, by default, Microsoft Access suggests that the database be created in the My Documents folder. If you want it located in another folder, you can click the Browse button Browse. This would open the File New Database dialog box where you can select an existing folder or create a new one using the Create New Folder button Create New Folder. Display the folder in the Save In combo box and click OK. Once you have specified the name of the database and its location, you can click Create.

Database Management

 

Introduction

Unlike some other programming environments, Microsoft Access considers a database as a single Windows file with a name. We will eventually learn that this file can contain various objects that actually make up a database. Therefore, a Microsoft Access database is opened as a normal file.

After you have created a database, as a computer file, it becomes part of what are known in Microsoft Windows as the most recently used (MRU) documents. As such, when you click the Office Button, the right side of the menu shows a list of MRUs. Here is an example of clicking the Office Button after a few databases have been created:

The number of files that the right column can display can be decreased as low as 1 or increased as high as 9. To change this number, access the Options dialog box by clicking the Office Button and clicking Access Options. In the left frame, click Advanced. In the right frame and in the Display section, change the value of the Show This Number Of Recent Documents:

Access Options

Database Properties

Whether you work alone or in a group, communication and documentation are important. Your database project has its own properties that you can use to find out some details about your file, to enter some notes about the project, or to give directives to other people who have access to the database. This can be done using a dialog box called the Database Properties. To access it, you can click the Office Button -> Manage -> Database Properties.

Opening a Database

To open a database, you can click the Office Button. If you see your intended database in the right column, you can click it to open it. 

In our description of the Microsoft Access interface, we saw that, at times, the right section is empty, at other times, such as when creating a new database, it is filled with some other options. Also, when you open Microsoft Access, the right side displays a list of MRUs. Here is an example:

Based on this, to open a database, if you are just starting Microsoft Access, on the right side under Open Recent Database, if you see the name of an existing database, you can click it.

If you locate a database in Windows Explorer, My Computer, My Documents, or any other window that displays the Microsoft Access file icon, you can just double-click the icon and open the database. If you received a database as an email attachment, you can also open the attachment and consequently open the database file.

Deleting a Database

If you have a database you do not need anymore, you can delete it. To delete a database, in My Documents, in Windows Explorer or another file management application:

  • You can click it to select it and press Delete
  • You can right-click it and click Delete

A warning message would be presented to you to confirm what you want to do.

After you have deleted a database, it doesn't disappear from the MRU lists of Microsoft Access. This means that, after a database has been deleted, you may still see it in the right column menu of the Office Button or in the list under the Open Recent Database column. If you try opening such a database, you would receive an error. Here is an example from trying to open a database named Things To Do after it had been deleted (although it still appears under Open Recent Database):

Microsoft Office Access

If a database has been deleted and you want to remove it from the MRU lists, open the Registry (Start -> Run: regedit, Enter). Open the following key:

HKEY_CURRENT_USER
    - Software
      - Microsoft
        - Office
          - 12
            - Access 
              - Settings

Locate the deleted database and delete its key.

The Size of a Database

A database is primarily a computer file, just like those created with other applications. As such, it occupies an amount of space in the computer memory. In some circumstances, you should know how much space a database is using. This can be important when you need to back it up or when it is time to distribute it. Also, when adding and deleting objects from your database, its file can grow or shrink without your direct intervention.

Like any other computer file, to know the size of a database, you can right-click it in Windows Explorer or My Computer and click Properties. If you are already using the database, to check its size, you can click the Office Button, position the mouse on Manage and click Database Properties. In the Properties dialog box, click General and check the Size label.

Compacting and Repairing a Database

As mentioned already, once you have created a database file, it occupies a certain amount of memory space that can grow or shrink without your direct intervention:

Database Size

When you add an object to the database, the database's file grows as needed. When you remove an object, the memory space it was occupying is left empty. This also applies when you keep removing objects:

Database Size

The computer is supposed to recuperate the space those previous objects were using. Unfortunately, that is not always the case. Most of the time, that space is left empty but cannot be accessed by the computer. This means that the memory space cannot be made available to other applications. To recover this memory space, you can compact the database. When this is done, the file is shrunk to occupy only the necessary amount of space and free the unused sections:

Database Size

To compact a database, you have two options. To compact and repair the database that is currently opened, and to compact it only once, click the Office Button, position the mouse on Manage, and click Compact and Repair Database. The database would be compacted behind the scenes.

To compact a database every time you close it, click the Office Button, and click Access Options. In the Access Options, in the left list, click Current Database. In the right list, click the Compact on Close check box:

And click OK.

 

Home Copyright © 2008-2016, FunctionX, Inc.