Since we want to see forms at work in a healthy database, we'll use a set of well-related tables as a database for building forms (our completed task 05.02).
Why use forms?
They give you a way to enter data into your database, display the data for review, and print it out.
- they are designed to make on-screen data entry and retrieval easier, as well as simplifying movement around your database application
- you can present information in just the way that you want by combining text, pictures, lines, boxes, and color to create a fully customized display
Each of the objects in Access has certain specific advantages for viewing data
- use a table to look at records stored only in that table
- use a query to look at records in multiple tables or to see only portions of your data
- use a report to group your data and present it in an attractive printed format
- but to make your data easy to see, enter, retrieve, and edit, use a form
A form provides an efficient way to enter data because rather than typing values into each field in a table, you can create drop-down lists to select the value you want
Forms do not store the data they present - they keep only your design parameters, allowing you to tinker with it without affecting your data
- once you save the form design, it will stay the same until you modify it. However, you will retrieve into the form the current data from the underlying table or query
- forms can be used to retrieve information from more than one table but they must be based on a single underlying table or query. So, if you want to pull data stored in other tables or queries you will need to use subforms.
Access Form Help
The Form tool creates a form tied to the table selected in the object window. Select Form and you get a form to work with, though it may not necessarily meet all your needs.
but it is powerful. If your table is related to one or more other objects, the Form tool will create a form that displays that relationship
Remember, forms are created for specific users, who have specific tasks to perform using the form. In creating the form, include only the form elements that the users need, and do not include elements that are extraneous to the users' needs.
Form Wizard - the most flexible wizard
If you wish to create a form that looks at data in several tables, use the wizard
It will ask you to select all of the fields that you want to include on the form, and then prompt you to choose the layout you think will work best
- unlike the Form options, it requires you to make decisions
- however, it is also the only option that allows you to work with fields stored in multiple tables to create a main form and a subform
- note that you can choose from more than one table or query.
note that the wizard allows you to choose fields from more than one table or query
Including More than One Table in a Form
use a subform, a form within a form, to include information from more than one table in a form. The primary form is the main form while the form within the form is the subform.
- the main form and the subform in this type of form are linked
- the subform displays only records related to those displayed in the main form
Subforms are most effective when you want to show data from tables or queries with a one-to-many relationship, like one author with many books.
a Main/Subform form shows a one-to-many relationship between the data in the main form and the data in the subform
Creating a Form/Subform
The easiest way to link a main form with a subform is to choose the Form Wizard when you create a new form
- by following the instructions on-screen, you can add all the fields to the form and get your desired layout
- you have to go back into the form's design view and tweak the design to match your needs
The main form is in a single-column format, and the subform is either in a datasheet or tabular layout.
Forms use graphical objects, called controls, to link the object back to the underlying table or query
- Text boxes display names and numbers stored in your underlying table or query
- Frames show pictures and graphs
- Labels display text as titles or other markers that describe data, but are not linked to information in the underlying table or query
- Other kinds of controls, like lines and rectangles, visually organize the information and group data on-screen.
There are three types of basic controls in Access: unbound, bound, and calculated
allow you to display information that is not stored in the database
- the title of the form or a descriptive label
- does not have a data source
- adding titles or descriptive labels, lines, and pictures
- Bound controls link information stored in the form's underlying table or query
- Calculated controls are a subset of bound controls, but operate on data taken from the table or query by using an expression