You can use the Form tool to create a form with a single mouse-click. When you use this tool, all the fields from the underlying data source are placed on the form. You can begin using the new form immediately, or you can modify it in Layout view or Design view to better suit your needs.
Use the Form tool to create a new form
- In the Navigation Pane, click the table or query that contains the data you want to see on your form.
- On the Create tab, in the Forms
group, click Form.
Access creates the form and displays it in Layout view. In Layout view, you can make design changes to the form while it is displaying data. For example, you can adjust the size of the text boxes to fit the data, if necessary. For more information about form views, see the Understand Layout view and Design view section.
If Access finds a single table that has a one-to-many relationship with the table or query that you used to create the form, Access adds a datasheet to the form that is based on the related table or query. For example, if you create a simple form that is based on the Employees table, and there is a one-to-many relationship defined between the Employees table and Orders table, the datasheet displays all the records in the Orders table that pertain to the current Employee record. You can delete the datasheet from the form if you decide you do not need it. If there is more than one table with a one-to-many relationship to the table that you used to create the form, Access does not add any datasheets to the form.
Top of PageA split form is a new feature in Microsoft Office Access 2007 that gives you two views of the data at the same time — a Form view and a Datasheet view.
The two views are connected to the same data source and are synchronised with each other at all times. Selecting a field in one part of the form selects the same field in the other part of the form. You can add, edit, or delete data from either part (provided that the record source is updateable, and you have not configured the form to prevent these actions).
Working with split forms gives you the benefits of both types of forms in a single form. For example, you can use the datasheet portion of the form to quickly locate a record, and then use the form portion to view or edit the record.
To create a split form by using the Split Form tool:
- In the Navigation Pane, click the table or query that contains the data that you want on your form. Or open the table or query in Datasheet view.
- On the Create tab, in the Forms
group, click Split Form .
Access creates the form and displays it in Layout view. In Layout view, you can make design changes to the form while it is displaying data. For example, you can adjust the size of the text boxes to fit the data, if necessary. For more information about form views, see the Understand Layout view and Design view section.
For more information about creating and working with a split form, see the article Create a split form.
Top of PageWhen you create a form by using the Simple Form tool, the form that Access creates displays a single record at a time. If you want a form that displays multiple records but is more customisable than a datasheet, you can use the Multiple Items tool.
- In the Navigation Pane, click the table or query that contains the data you want to see on your form.
- On the Create tab, in the Forms group, click Multiple Items .
Access creates the form and displays it in Layout view. In Layout view, you can make design changes to the form while it is displaying data. For example, you can adjust the size of the text boxes to fit the data. For more information about form views, see the Understand Layout view and Design view section.
When you use the Multiple Items tool, the form that Access creates resembles a datasheet. The data is arranged in rows and columns, and you see more than one record at a time. However, a Multiple Items form gives you more customisation options than a datasheet, such as the ability to add graphical elements, buttons, and other controls. For more information about customising your form, see the sections Fine-tune your form in Layout view, Fine-tune your form in Design view, and Add controls to your form.
Top of PageTo be more selective about what fields appear on your form, you can use the Form Wizard instead of the various form-building tools previously mentioned. You can also define how the data is grouped and sorted, and you can use fields from more than one table or query, provided that you specified the relationships between the tables and queries beforehand. For more information about creating relationships, see the links in the See Also section of this article.
- On the Create tab, in the Forms group, click More Forms, and then click Form Wizard .
- Follow the directions on the pages of the Form Wizard.
Note If you want to include fields from multiple tables and queries on your form, do not click Next or Finish after you select the fields from the first table or query on the first page of the Form Wizard. Instead, repeat the steps to select a table or query, and click any additional fields that you want to include on the form. Then click Next or Finish to continue. - On the last page of the wizard, click Finish.
If the wizard or the form-building tools don't fit your needs, you can use the Blank Form tool to build a form. This can be a very quick way to build a form, especially if you plan to put only a few fields on your form.
- On the Create tab, in the Forms
group, click Blank Form .
Access opens a blank form in Layout view, and displays the Field List pane.
- In the Field List pane, click the plus sign (+) next to the table or tables that contain the fields that you want to see on the form.
- To add a field to the form, double-click it or drag it onto the form.
To add several fields at once, hold down CTRL and click several fields,
and then drag them onto the form at the same time.
Note The order of the tables in the Field List pane can change, depending on which part of the form is currently selected. If you are not able to add a field to the form, try selecting a different part of the form and then try adding the field again. For more information about using the Field List pane, see the article Add a field to a form or report. - Use the tools in the Controls group on the Format
tab to add a logo, title, page numbers, or the date and time
to the form.
- If you want to add a wider variety of controls to the form, switch
to Design view by right-clicking the form and then clicking Design
View . You can then use the tools in the Controls
group on the Design tab.
Controls are objects that display data, perform actions, and let you view and work with information that enhances the user interface, such as labels and images. The most commonly used control is the text box, but other controls include labels, check boxes, and subform/subreport controls.
Controls can be bound, unbound, and calculated:
- Bound control A control whose source of data is a field in a table or query is called a bound control. You use bound controls to display values that come from fields in your database. The values can be text, dates, numbers, Yes/No values, pictures, or graphs. For example, a text box on a form that displays an employee's last name might get this information from the Last Name field in the Employees table.
- Unbound control A control that doesn't have a source of data (such as a field or expression) is called an unbound control. You use unbound controls to display information, lines, rectangles, and pictures. For example, a label that displays the title of a form is an unbound control.
- Calculated control A control whose source of data is an expression, rather
than a field, is called a calculated control. You specify the value that you want
to use as the source of data in the control by defining an expression. An expression
can be a combination of operators (such as = and + ), control names, field names,
functions that return a single value, and constant values. For example, the following
expression calculates the price of an item with a 25 percent discount by multiplying
the value in the Unit Price field by a constant value (0.75).
=[Unit Price] * 0.75
An expression can use data from a field in the form's underlying table or query, or data from another control on the form.
For more information about expressions, see the links in the See Also section.
When you create a form, it is probably most efficient to add and arrange all the bound controls first, especially if they make up the majority of the controls on the form. You can then add the unbound and calculated controls that complete the design by using the tools in the Controls group on the Design tab in Design view.
You bind a control to a field by identifying the field from which the control gets its data. You can create a control that is bound to the selected field by dragging the field from the Field List pane to the form. The Field List pane displays the fields of the form's underlying table or query. To display the Field List pane, press ALT+F8, or on the Design tab, in the Tools group, click Add Existing Field. When you double-click a field in the Field List pane, Access adds the appropriate type of control for that field to the form.
Alternatively, you can bind a field to a control by typing the field name in the control itself or in the box for the Control Source value in the control's property sheet. The property sheet defines the characteristics of the control, such as its name, the source of its data, and its format. To open the property sheet, press F4.
Using the Field List pane is the best way to create a bound control for two reasons:
- Access automatically fills in the control's attached label with the name of the field (or the caption defined for that field in the underlying table or query), so you don't have to type the control's label yourself.
- Access automatically sets many of the control's properties to the appropriate values according to the properties of the field in the underlying table or query (such as the Format, Decimal Places, and Input Mask properties).
If you already created an unbound control and want to bind it to a field, set the value in the control's Control Source property box to the name of the field. For details about the Control Source property, press F1 while the cursor is in the property's drop-down list.