Section 135. Create a Database

135. Create a Database


Just jump right in!


136 Enter Data Using a Form

137 Create a Form

138 Access an Existing Database

If you want to keep track of related datasuch as relative's names and addressescreate a database . You can then use the information in this database with any of your components . For example, you could use your new Relatives database to address reunion party invitations for your parents, brothers, sisters, aunts, uncles, and cousins using the MailMerge Wizard as described in 37 Use the MailMerge Wizard .

135. Create a Database

After creating a database, you can open it again for editing from any component (and start Base at the same time) by simply choosing File, Open or clicking the Open button. If you're not running at the moment, you can open an existing Base database by double-clicking the database file in Windows Explorer.


If you start Base from the Start menu, you'll have only two options, as you'll learn in this task: to create a new database, or to register and edit a database created in some other application such as dBASE or Microsoft Access. You cannot open an existing Base database this way.

Click Create a New Database

Start Base, and in Step 1 of the Database Wizard which automatically launches, select the Create a new database option and click Next .


If you're already working in Base and you want to create a new database, click the New button on the Standard toolbar, and then choose Database from the menu that appears. The Database Wizard starts, and you can continue to step 2.

Register the Database

In Step 2 of the Database Wizard , select Yes, register the database for me. This option allows you to use the database in other components. If you intend to use the new database only in Base, you can select No, do not register the database .

Prepare for Editing and Click Finish

In Step 2 of the Database Wizard , enable the Open the database for editing check box so that you can work on the database after the initial file is created and saved.

Also enable the Create tables using table wizard check box. Because you must create at least one table in a database before you can start entering data, enabling this second option allows you to get started on that right after the database is created and saved. Click Finish. The Save As dialog box appears.

Save the Database

In the Save As dialog box, type a name for your new database in the File name text box. Change to the folder in which you want to save your database and then click Save to save the file. Because you enabled the Create tables using table wizard check box in step 3, the Table Wizard appears to help you create the first table in your database.

Choose a Sample Table

In Step 1 of the Table Wizard , select a sample table to build your first table from. First, choose a Category , either the Business or Personal . Then choose a table from the Sample tables list. A list of fields in that table category appears in the Available fields list.

Select Fields to Use

Select the first field you want to use from those listed in the Available fields list and click > to add that field to the list of Selected fields for your table. Typically, the first field you select is the primary key , which is a field with "ID" in its name. Here I choose CustomerID , with the intent of using it to enter each driver's unique driver number. If you don't have some field in mind that's unique to each record, you can have Base add a primary key field for you in step 8. If you choose a field to act as the primary key, you will designate it as the primary key in step 8.

Repeat this step (selecting a field and clicking > ) to add each additional field you want the table to have to the Selected fields list. You can change to a different sample table by repeating step 5 if you want to use a field located in some other sample table. When you're done adding fields to your table, click Next .


If you can't find the exact field you want to use, select one that's similar and then modify the field to suit your exact needs in step 7.

You can rearrange the fields in the Selected fields list by clicking a field and then pressing the or key on your keyboard to move that field up or down within the listing.


Primary key A field that is never duplicated in any record in a database.

Set Field Properties

In Step 2 of the Table Wizard , change the properties of each field as needed. Start by selecting a field from the Selected fields list. Then change the Field name, Field Type , and so on as needed. Repeat this step for each field in the table, and then click Next .

I selected my primary key ( CustomerID ) and changed its Field name to DriverID which made more sense to me. I also changed the FieldType to a small integer because the driver ID number is small, from 1 to 99. I then selected each field in my table and made adjustments as needed. For example, I selected FirstName and changed the Entry required field to Yes to ensure that a first name is always entered for each driver. I did the same thing with the LastName field. I changed the CompanyName field to TeamName , and made that field required as well. I made similar changes to other fields until everything was set up as I wanted.

Set Primary Key

In Step 3 of the Table Wizard , set up your primary key. First, enable the Create a primary key check box.

If you didn't select a field to act as your primary key in step 6, then choose Automatically add a primary key and enable the Auto value option, which will cause Base to add a primary key field and create a unique number for each record.

If you have a field in the table that can serve as the primary key, choose Use an existing field as primary key , and then choose that field from the Fieldname list. Here I choose DriverID (which shows up in the list under its original name, which was CustomerID ). I didn't want to enable the Auto value option because I intend to enter the DriverID myself , but if you want to have Base automatically fill the field you select as the primary key with a unique number, enable the Auto value check box.

If you have several fields that together form a unique ID that won't be duplicated by any other record, choose the Define primary key as a combination of several fields option, and then select the first field you want to use in forming the primary key and click > to add it to the Primary key fields list. Repeat this step to add other fields to the list to create a primary key from that combination of selected fields.

When you have established the primary key for your table, click Next .

Name the Table and Click Finish

In Step 4 of the Table Wizard , type a name for the table in the What do you want to name your table? text box. I named my table Drivers because it will hold the data for each Indy Car driver.

Choose the Insert data immediately option (to enter data using List view) or Create a form based on this table (to enter data using a form) and then click Finish to add the table to the database. If you chose Insert data immediately, the table appears in List view. See 136 Enter Data in List View for help in entering data into the table in this view. If you chose Create a form based on this table , see 137 Create a Form for help in creating an entry form you can use to enter data more easily into a complex table with lots of fields. Because you don't really need to make any modifications to the table you created in steps 58, there's no need to choose Modify the table design , which takes you to Design view so you can modify the table.


You can add more tables to your database if desired. After entering data for my Drivers table using List view, I added a Team table for team data and a Car table for data about each car by clicking the Tables icon in the Database pane, clicking the Use Wizard to Create Table option, and following steps 5 to 9 in this task to create another table in my database. 2, Firefox, and Thunderbird for Windows All in One
Sams Teach Yourself 2, Firefox and Thunderbird for Windows All in One
ISBN: 0672328089
EAN: 2147483647
Year: 2005
Pages: 232
Authors: Greg Perry © 2008-2017.
If you may any questions please contact us: