
Chapter 7: Databases and Data Sources
TypeName Text [VARCHAR] Entry Required = Yes; Length = 50
3. Right-click the field selector for the ID field and choose Primary Key.
4. Click File > Save As.
5. Enter Types for the table name and click OK.
6. Close the table design window by clicking File > Close.
7. Click File > Save in the database window to save your work.
Creating a relationship between tables
Now, to make the Types table more useful to us, we need to create a relationship between the
two tables. A relationship means that two or more tables share information. They link a
primary key to a foreign key. A primary key is unique. In the Calendar database, the primary
key for the relationship we set up in the follow steps is the ID field in the Types table. The
foreign key is the Type field in the Appointments table.
1. Click Tools > Relationships. The Relation design window is displayed with the Add
Tables dialog in front of it.
2. Click the Appointments table in the list and click Add.
3. Click the Types table and click Add. Both tables should appear in the Relation
design window.
4. Click Close in the Add Tables dialog.
5. In the Relation design window, click the lower edge of the Appointments table and
drag down to make the window for the table larger.
6. Click the Type entry in the Appointments table and drag it over the ID entry in the
Types table. A line will connect the two entries.
7. Click File > Save to save your work.
8. Close the Relation design window.
9. Save the database.
At this point in the creation of the sample database, a form was created to simplify data entry
into the Types table. For the sake of brevity, these steps are skipped. Data may be directly
entered into a table, though it is not recommended.
Creating a data entry form
However, the following are steps for creating the data entry form for new appointments are
presented here.
OpenOffice.org User Guide for 2.x 367
Comentarios a estos manuales