
Creating tables for the list box
When the same information can be used in several fields, design a
table for each type of information. Each table will contain two fields:
the information field and ID, in that order.
Caution
You must create these tables with the information field listed
first and the ID field listed last. Failure to do so will produce
the wrong results. For my Payment table, I use Name and ID as
my fields, with Dan, Kevin, and Cash being the Name entries.
The corresponding ID entries are 0, 1, 2. When the Name field
is listed first in the table, one of the three names will appear in
the payment field of the Fuel table. If the ID field is listed first,
0, 1, or 2 appear in the payment field instead.
1) Follow the directions in “Creating tables in Design View” on page
259. In the table, the two fields can be Type and PaymentID. In
the Field Properties, set AutoValue to Yes for the PaymentID field.
Set the PaymentID field as the primary key. (See Figure 190.)
2) Save the table using the name Payment Type.
Figure 190: Table in Design View
Note:
If you have several tables to create with the same fields, design
one table and produce the other tables by cutting and pasting.
(See “Creating a table by copying an existing table” on page
259.)
Adding data to the list table
List tables do not require a form. Instead, add their data directly to the
table. In this example, use the names of the two people with a bank
card and Cash for cash purchases.
1) In the main database window, click on the Tables icon (Figure
183). In the list of tables, right-click on Payment Type and select
Open from the pop-up menu.
a) Enter Dan in the Type column in the first row. Press the Tab
key to move to the second row. Notice that the PaymentID
value for this row changes from <AutoField> to 0.
b) Enter Kevin in the second row. The PaymentID changes to 1.
Chapter 8 Getting Started with Base 263
Comentarios a estos manuales