Introduction to forms

A form is a database object that you can use to create a user interface for a database application. A "bound" form is one that is directly connected to a data source such as a table or query, and can be used to enter, edit, or display data from that data source. Alternatively, you can create an "unbound" form that does not link directly to a data source, but which still contains command buttons, labels, or other controls that you need to operate your application.

This article focuses primarily on bound forms. You can use bound forms to control access to data, such as which fields or rows of data are displayed. For example, certain users might need to see only several fields in a table with many fields. Providing those users with a form that contains only those fields makes it easier for them to use the database. You can also add command buttons and other features to a form to automate frequently performed actions.

Think of bound forms as windows through which people see and reach your database. An effective form speeds the use of your database, because people don't have to search for what they need. A visually attractive form makes working with the database more pleasant and more efficient, and it can also help prevent incorrect data from being entered.

 Note   This article assumes you have already created a table (or a query based on one or more tables), and that you want to build a form to view or manipulate the data. For more information about tables and queries, see the links in the See Also section of this article.

In this article


Create a form by using the Form tool

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 start 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

  1. In the Navigation Pane, click the table or query that contains the data you want to see on your form.
  2. 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.

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 that is defined between the Employees table and Orders table, the datasheet displays all the records in the Orders table that relate 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 Page Top of Page

Create a split form by using the Split Form tool

 Note   You can add a split form to a Web database, but you cannot run the form unless you open the Web database by using Access (in other words, it will not run in a Web browser). For more information about Web databases, see the article Build a database to share on the Web.

A split form gives you two views of the data at the same time — a Form view and a Datasheet view.

A split form differs from a form/subform combination in that the two views are connected to the same data source and are synchronized with one another 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 (as long as the record source is updatable, and you have not configured the form to prevent these actions).

Working with split forms gives you the benefits of both kinds 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:

  1. 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.
  2. On the Create tab, in the Forms group, click More Forms, and then 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.

Top of Page Top of Page

Create a form that displays multiple records by using the Multiple Items tool

When you create a form by using the 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 customizable than a datasheet, you can use the Multiple Items tool.

  1. In the Navigation Pane, click the table or query that contains the data you want to see on your form.
  2. On the Create tab, in the Forms group, click More Forms, and then 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 customization options than a datasheet, such as the ability to add graphical elements, buttons, and other controls. For more information about customizing your form, see the sections Fine-tune your form in Layout view and Fine-tune your form in Design view.

Top of Page Top of Page

Create a form by using the Form Wizard

To 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, as long as you specified the relationships between the tables and queries beforehand. For more information about how to create relationships, see the links in the See Also section of this article.

  1. On the Create tab, in the Forms group, click Form Wizard.
  2. 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.

  1. On the last page of the wizard, click Finish.

Top of Page Top of Page

Create a form by using the Blank Form tool

If the wizard or the form-building tools don't meet 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.

  1. 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.

  1. 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.
  2. To add a field to the form, double-click it or drag it onto the form.

 Notes 

  • After the first field has been added, you can add several fields at once by holding down the CTRL key, clicking several fields, and then dragging them onto the form at the same time.
  • The order of the tables in the Field List pane can change, depending on which part of the form is currently selected. If the field you want to add is not visible, try selecting a different part of the form and then try adding the field again.
  1. Use the tools in the Header/Footer group on the Design tab to add a logo, title, or the date and time to the form.
  2. Use the tools in the Controls group of the Design tab to add a wider variety of controls to the form.

For a slightly larger selection of controls, switch to Design view by right-clicking the form and then clicking Design View.

Controls that you add while in Design view might not be compatible with the Publish to Web feature. If you plan to publish the form to the Web, you must use only the features that are available in Layout view.

Top of Page Top of Page

Understand Layout view and Design view

Layout view    Layout view is the most intuitive view to use for form modification, and it can be used for almost all the changes that you would want to make to a form in Access. If you create a database by clicking Blank Web Database in Microsoft Backstage View, then Layout view is the only view that is available for designing forms.

In Layout view, the form is actually running. Therefore, you can see your data much as it will appear when you are using the form. However, you can also change the form design in this view. Because you can see the data while you are modifying the form, this is a very useful view for setting the size of controls or performing almost any other task that affects the appearance and usability of the form.

If you are creating a standard desktop database (as opposed to a Web database), and you encounter a task that cannot be performed in Layout view, you can switch to Design view. In certain situations, Access displays a message that states that you must switch to Design view before you can make a particular change.

Design view    Design view gives you a more detailed view of the structure of your form. You can see the Header, Detail, and Footer sections for the form. The form is not actually running when it is shown in Design view. Therefore, you cannot see the underlying data while you are making design changes. However, there are certain tasks that you can perform more easily in Design view than in Layout view. You can:

  • Add a wider variety of controls to your form, such as bound object frames, page breaks, and charts.
  • Edit text box control sources in the text boxes themselves, without using the property sheet.
  • Resize form sections, such as the Form Header or the Detail section.
  • Change certain form properties that cannot be changed in Layout view.

Top of Page Top of Page

Fine-tune your form in Layout view

After you create a form, you can easily fine-tune its design by working in Layout view. Using the actual form data as your guide, you can rearrange the controls and adjust their sizes. You can place new controls on the form and set the properties for the form and its controls.

To switch to Layout view, right-click the form name in the Navigation Pane and then click Layout View.

Access shows the form in Layout view.

You can use the property sheet to change the properties for the form and its controls and sections. To display the property sheet, press F4.

You can use the Field List pane to add fields from the underlying table or query to your form design. To display the Field List pane:

  • On the Design tab, in the Tools group, click Add Existing Fields.

Keyboard shortcut  Press ALT+F8.

You can then drag fields directly from the Field List pane onto your form.

  • To add a single field, double-click it or drag it from the Field List pane to the section on the form where you want it displayed.
  • To add several fields at once, hold down CTRL and click the fields that you want to add. Then drag the selected fields onto the form.

Top of Page Top of Page

Fine-tune your form in Design view

In desktop databases, you can fine-tune your form's design by working in Design view. You can add new controls and fields to the form by adding them to the design grid. The property sheet gives you access to many properties that you can set to customize your form.

To switch to Design view, right-click the form name in the Navigation Pane and then click Design View.

 Note   Design view is not available when you are working in a Web database.

Access shows the form in Design view.

You can use the property sheet to change the properties for the form and its controls and sections. To display the property sheet, press F4.

You can use the Field List pane to add fields from the underlying table or query to your form design. To display the Field List pane:

  • On the Design tab, in the Tools group, click Add Existing Fields.

Keyboard shortcut  Press ALT+F8.

You can then drag fields directly from the Field List pane onto your form.

  • To add a single field, double-click it or drag it from the Field List pane to the section on the form where you want it displayed.
  • To add several fields at once, hold down CTRL and click the fields that you want to add. Then drag the selected fields onto the form.

Top of Page Top of Page

Try Office 2010 today!

 
 
Applies to:
Access 2010