Creating forms and reports
Creating a form
Forms MS Access allows you to create a user interface for database tables. Although you can use the table mode to perform the same functions, the forms provide the benefits for presenting data in an orderly and attractive way.
The form is a kind of electronic form, in which there are fields for data entry. In the form, each field can be placed in an exactly specified place, choose the color and fill for it. You can put calculated fields in the form. OLE-objects can be seen only in the form or report. In the form it is much easier to work with large text fields of type MEMO in a text box with scroll bars.
The form is based on an Access table or query. Every time you open a saved form, you update
query data, on the basis of which the form is created. Due to this, the form content always corresponds to the information in the tables and queries.
Forms can be displayed in several forms: design mode, table mode, layout mode and form mode. To switch from one mode to another, you can use the Modes commands of the Work with form layout tab.
Microsoft Access provides several ways to create a form.
Creating a form using the Form tool. Using the Form tool you can create a form with a single click. When using this tool, all fields of the data source (table or query) are placed on the form. If necessary, you can change the form in Layout or Design mode.
In order to create a new form, you need:
• In the navigation pane, click on the table or query whose data should be displayed in the form;
• On the Create tab in the Forms group, click the Form button (Figure 10.47).
Fig. 10.47. Form button
A new form will be created and displayed in layout mode. In layout mode, you can make changes to the form structure while displaying the data at the same time. For example, if necessary, you can adjust the size of the fields according to the data.
If the MSAccess application detects a single table that is associated with a one-to-many relationship with the table or query that was used to create the form, it adds the data table to a form based on the associated table or query. For example, if you create a form based on the Firms the example above, and between the tables Firms and Warehouses a one-to-many relationship is defined, all entries in the table Warehouses related to the current company record will be displayed in the data table (see Figure 10.48). If the table
Fig. 10.48. Creating a Form & quot; Firms & quot; using the & quot; Form & quot; tool
The data in the form is not needed, it can be deleted. If there are several tables that are related to the one-to-many relationship & quot; with the table that was used to create the form, MS Access does not add the data table to the form.
Creating a form using the Form Wizard. To get more flexibility in selecting the fields displayed on the form, you can use the Form Wizard. In addition, you can specify how to group and sort the data, and also include fields from several tables or queries in the form.
To create a form using the Form Wizard, you must:
• On the Create tab in the Forms group, click the Forms Wizard ;
• Follow the instructions on the Form Wizard pages.
Creating a form using the & quot; Empty form & quot; tool. If the above described form creation tools do not work, you can use the & quot; Empty form & quot; tool to create a form. To do this, you must do the following:
• On the Create tab in the Forms group, click the Empty form button. MS Access will open an empty form in layout mode and display the Fields List
• In the Fields List area, click the plus sign & quot; next to the table or tables that contain the fields you want to include in the form;
• to add a field to the form, double-click it and drag it to the form;
• Using the tools in the Headers and Footers group on the Constructor tab, you can add an emblem (a design used as an emblem), a title, or a date and time.