Creating Auxiliary Tables for Data Entry

From Apache OpenOffice Wiki
Jump to: navigation, search




Creating Auxiliary Tables for Data Entry

It is often useful to have tables that provide a list of the possible values that a field in another table may have. For example, the Expenses table defined above has a field named ExpenseType. If people are allowed to enter anything in that field, a variety of words may be entered for one item. Buying gasoline might be entered as gasoline, gas, Gas, fuel, or several other possibilities. The entries might also have leading or trailing spaces that are hard to notice. All of that can be dealt with when the table is queried but limiting the entries, even if only you will use the database, leads to a cleaner data set.

For the present case of the ExpenseType field, we will make the simplest possible table with just one column that will serve as both the primary key and the useful data.

Click the Tables icon in the Database region of the main window and choose Create Table in Design View in the Tasks pane. Give the field the name ExpType and leave the field type as TEXT [VARCHAR]. Before leaving that row of the design table, right-click on the small green arrow at the left edge of the row and select Primary Key Save the table using File → Save with the name Expense_Categories and close it.

Adding Data to the List Table

You should now be back at the main Base window. In the Tables pane, right-click on the icon for Expense_Categories and select Open. Enter the values Supplies, Equipment, Travel, Meals as the first four values of the ExpType column. You can close the table without saving it, because the values were saved automatically as you entered them. Do be sure to complete the entry of the last value by pressing  ↵ Enter  or the down arrow to move to a new row before closing the window.

An alternative to this very simple table structure is to define a primary key column that is separate from the values you want to display in the Form when entering data. This is discussed further in the next section.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools