The US Senate Database: Forms |
|
Accessory Forms
Introduction
In a classic database, you usually need to create corresponding forms and probably equivalent reports or Data Access Pages to the accessories tables. Because such tables are sometimes hardly used, they can be neglected. For example, we create a table for senators genders. Since there are only male and female senators, you would think that there is no need to create a corresponding form because there never be any need to add values to it. After all, we don't expect to have an hermaphrodite senator, at least as long as no one claims to be one. On the other hand, for statistic reasons, you may want to get a list of male, then a list of female senators in your database. For this and many other reasons, you should create forms for (most of) your access tables.
Automatic Forms
Accessory forms are particularly easy to create, regardless of the version of MS Access you are using. The main difference is that MS Access >= 2000 creates subforms when you use AutoForm. Therefore, AutoForm is a valuable feature to quickly create forms. In MS Access >= 2000, the automatic subform can be annoying. Fortunately, you can remove them very easily. In fact, we will not use them for our database.
Relations-Based Forms
Relations-Based Controls
Relationships on a database are particularly important as they allow information to flow from one object to another, thereby reducing duplicate information. One of the prime controls used in such relationships is the combo box.
If you create a foreign key on a table using the Lookup Wizard, the field would become a combo box, also called lookup list. This conveniently allows the user to select the value of the field from a list instead of typing it. When creating the corresponding form, report, or Data Access Pages for the table, the field for that foreign key would be created as a combo box. If you created the field only as a numeric type, you would need to create its relationship with the primary key of its parent table. When creating the table, you can then use either the Combo Box Wizard or create a SQL statement you would assign to the combo box to use as the list or items.
Intermediary Forms
You may have noticed that we create some tables made of only fields from other tables. These tables are the solution to a Many-To-Many relationship. The reason is that they allow you to put together, in one list, values that are stored in different tables but cannot professionally be created in the same table. Therefore, this table, also called junction table is used as intermediary to create a complex list.
To create a form that uses a junction table, you should(must) first make sure that the relationships have been established between the junction tables and those that are supposed to provide it with necessary values. We took care of that by creating and managing the relationships.
When creating the table, if you use the Lookup Wizard, each table would be added as a combo box. When creating the form, you can simply drag the item from the Field List and it would be added as a combo box. When creating the table, if you used the classic approach as done on SQL Server and other database environment, which consists of using a numeric data type for each foreign key, the field can only be added as a regular text box. To make it a combo box so it would display it real list, you can either use the Combo Box Wizard or create a SQL expression to be assigned to the combo box.
|
||
Previous | Home | |
|