Using Databases with Base

OpenOffice.org includes a database module: Base. Use Base to design a database to store many different kinds of information, from a simple address book or recipe file to a sophisticated document management system.

Tables, forms, queries, and reports can be created manually or using convenient wizards. For example, the Table Wizard contains a number of common fields for business and personal use. Databases created in Base can be used as data sources, such as when creating form letters.

It is beyond the scope of this document to detail database design with Base. More information can be found at the sources listed in Section 1.2, “Finding Help and Information About OpenOffice.org”.

Creating a Database Using Predefined Options

Base comes with several predefined database fields to help you create a database. The steps in this section are specific to creating an address book using predefined fields, but it should be easy to follow them to use the predefined fields for any of the built-in database options.

The process for creating a database can be broken into several subprocesses:

Creating the Database

First, create the database.

  1. Click File+New+Database.

  2. Select Create a new database+Next.

  3. Click Yes, register the database for me to make your database information available to other OpenOffice.org modules, select both check boxes in the bottom half of the dialog, then click Finish.

  4. Browse to the directory where you want to save the database, specify a name for the database, then click OK.

Setting Up the Database Table

Next, define the fields you want to use in your database table.

  1. In the Table Wizard, click Personal.

    The Sample tables list changes to show the predefined tables for personal use. If you had clicked Business, the list would contain predefined business tables.

  2. In the Sample tables list, click Addresses.

    The available fields for the predefined address book appear in the Available fields menu.

  3. In the Available fields menu, click the fields you want to use in your address book.

    You can select one item at a time, or you can shift-click multiple items to select them.

  4. Click the single to move the selected items to the Selected fields menu.

    To move all available fields to the Selected fields menu, click the double right-arrow.

  5. Use the and keys to adjust the order of the selected fields.

    The fields appear in the table and forms in the order in which they are listed.

  6. Click Next.

  7. Make sure each of the fields is defined correctly.

    You can change the field name, type, whether the entry is required, and the maximum length of the field (the number of characters that can be entered in that field). For this example, leave the settings as they are.

  8. Click Next.

  9. Click Create a primary key, click Automatically add a primary key, click Auto value, then click Next.

  10. Accept the default name for the table, select Create a form based on this table, then click Finish.

Creating a Form

Next, create the form to use when entering data into your address book.

  1. In the Form Wizard, click the double right-arrow icon to move all available fields to the Fields in the form list, then click Next twice.

  2. Select how you want to arrange your form, then click Next.

  3. Select the option to use the form to display all data and leave all of the check boxes empty, then click Next.

  4. Apply a style and field border, then click Next.

    For this example, accept the default selections.

  5. Name the form, select the Modify the form option, then click Finish.

Modifying the Form

After the form has been defined, you can modify the appearance of the form to suit your preferences.

  1. Close the form that opened when you finished the previous step.

  2. In the main window for your database, right-click the form you want to modify (there should be only one option), then click Edit.

  3. Arrange the fields on the form by dragging them to their new locations.

    For example, move the First Name field so it appears to the right of the Last Name field, and then adjust the locations of the other fields to suit your preference.

  4. When you have finished modifying the form, save it and close it.

What’s Next?

After you have created your database tables and forms, you are ready to enter your data. You can also design queries and reports to help sort and display the data.

Refer to OpenOffice.org online help and other sources listed in Section 1.2, “Finding Help and Information About OpenOffice.org” for additional information about Base.