Introduction to controls
This article describes the different kinds of controls available in Access, and shows how to add controls to forms and reports. Controls are the parts of a form or report that you use to enter, edit, or display data. For example, a text box is a popular control for displaying data on reports, or for entering and displaying data on forms. Other popular controls include command buttons, check boxes, and combo boxes (drop-down lists).
In this article
Controls let you view and work with data in your database application. The most frequently used control is the text box, but other controls include command buttons, labels, check boxes, and subform/subreport controls.
Controls can be bound, unbound, or 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 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, pictures, lines or rectangles. 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 or report's underlying table or query, or data from another control on the form or report.
When you create a form or report, it is probably most efficient to add and arrange all the bound controls first, especially if they make up most of the controls on the object. 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 Layout view or 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 or report. The Field List pane displays the fields of the form's underlying table or query. To display the Field List pane, open the object in Layout view or Design view, and then on the Design tab, in the Tools group, click Add Existing Fields. When you double-click a field in the Field List pane, Access adds the appropriate type of control for that field to the object.
Alternatively, you can bind a field to a control by typing the field name in the control itself (if the object is open in Design view), or in the Control Source property box 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 display or hide 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.
Layouts are guides that align your controls horizontally and vertically to give your form a uniform appearance. You can think of a layout as a table, where each cell of the table is either empty or contains a single control. The following procedures show how to add, remove, or rearrange controls in layouts.
For more information about Web databases, see the article Build a database to share on the Web.
Layouts can be configured in many different ways, but are usually configured in a tabular or a stacked format. Within these two main formats, you can split or merge cells to customize the layout to better suit your controls. For more information, see the section Split or merge cells in a layout.
In tabular control layouts, controls are arranged in rows and columns like a spreadsheet, with labels across the top, as shown in the following illustration:
Tabular control layouts always span two sections of a form or report. Whichever section the controls are in, the labels are in the section above.
In stacked layouts, controls are arranged vertically like you might see on a paper form, with a label to the left of each control, as shown in the following illustration:
Stacked layouts are always contained within a single section on the form or report.
Access automatically creates tabular layouts in either of the following circumstances:
You create a new report by clicking Report in the Reports group on the Create tab.
You create a new report by clicking Blank Report in the Reports group on the Create tab, and then dragging a field from the Field List pane to the report.
Access automatically creates stacked layouts in either of the following circumstances:
You create a new form by clicking Form in the Forms group on the Create tab.
You create a new form by clicking Blank Form in the Forms group on the Create tab, and then dragging a field from the Field List pane to the form.
In this section
Create a new layout
On an existing form or report object, you can create a new control layout by doing the following:
Select a control that you want to add to the layout.
If you want to add other controls to the same layout, hold down the SHIFT key and also select those controls.
On the Arrange tab, in the Table group, click Tabular or Stacked.
Access creates the layout and adds the selected controls to it.
Switch a layout from tabular to stacked, or from stacked to tabular
To switch an entire layout from one type of layout to the other:
Select a cell in the layout that you want to change.
On the Arrange tab, in the Rows & Columns group, click Select Layout.
On the Arrange tab, in the Table group, click the layout type you want (Tabular or Stacked).
Access rearranges the controls into the layout type that you want.
Split one layout into two layouts
You can split a control layout into two layouts by doing the following:
Hold down the SHIFT key and click the cells that you want to move to the new layout.
On the Arrange tab, in the Table group, click the layout type you want for the new layout (Tabular or Stacked).
Access creates a new control layout and adds the selected controls to it.
Add rows or columns to a layout
Select a cell adjacent to where you want to add the new row or column.
On the Arrange tab, in the Rows & Columns group, click Insert Above or Insert Below to insert a new row above or below the current row. Click Insert Left or Insert Right to insert a new column to the left or right of the current column.
Access adds the new row or column to the layout.
Remove rows or columns from a layout
Select a cell in the row or column that you want to remove.
On the Arrange tab, in the Rows & Columns group, click Select Column or Select Row to select the column or row.
Press the DELETE key.
Access deletes the row or column from the layout.
Split or merge cells in a layout
Like a table in a word processing document, a layout is made up of cells that are arranged in rows and columns. Each cell can contain one control, such as a text box, a label, or a command button. You can split one cell horizontally or vertically to create two cells, or you can merge multiple cells together to create one large cell that spans multiple rows or columns in the layout. Even if a cell spans multiple rows or columns, it can still contain only one control.
When you split a cell vertically, you create a new row in the structure of the layout. If there are other cells on the same row as the one that you split, they remain the same size (they span the two underlying rows that result from the split operation). When you split a cell horizontally, you create a new column in the structure of the layout. If there are other cells in the same column as the one that you split, they remain the same size (they span the two underlying columns that result from the split operation).
Select the first cell that you want to merge.
Hold down the SHIFT key and select the other cells that you want to merge.
On the Arrange tab, in the Merge / Split group, click Merge.
Rearrange controls in a layout
You can move a control within a layout, or between layouts, by dragging it to the location that you want. As you drag the control, a horizontal or vertical bar indicates where it will be placed when you release the mouse button. If you drag the control over an empty cell, Access highlights the whole cell to indicate where the control will be placed.
You can also move a control within a layout by selecting it, holding down the ALT key, and then using the arrow keys to move the control.
If you use the ALT+arrow key combination to move a control to the left or right, and you move it outside the boundaries of the layout, Access adds new columns to the layout as needed to accommodate the move. These new columns will remain even if you move the control back to its original location, and can have the unintended consequence of widening the report so that it extends onto another page. On reports, this can cause blank pages to print, due to the extra width of the report object. To delete an empty column in a layout, in Layout view, select a cell in that column, and then press the DELETE key. When the layout no longer crosses the page boundary, Access automatically resizes the report back down to the original page width.
Add controls to a layout
To add a new field from the Field List pane to an existing control layout
Drag the field from the Field List pane to the layout. A horizontal or vertical bar indicates where the field will be placed when you release the mouse button. If you drag the field over an empty cell, Access highlights the whole cell to indicate where the field will be placed.
To add existing controls to an existing control layout
In Layout view, select the first control you want to add to the control layout.
If you want to add other controls to the same layout, hold down the SHIFT key and also select those controls. You can select controls in other control layouts.
Drag the selected fields to the layout. A horizontal or vertical bar indicates where the fields will be placed when you release the mouse button.
Remove controls from a layout
Removing controls from a layout enables you to place the controls anywhere on the form or report without affecting the positioning of any other controls.
If you plan to use a form or report as part of a Web application, all of its controls must be contained in layouts.
On the Home tab, in the Views group, click Views, and then click Design view.
Select the cells that you want to remove from the layout, including any labels. To select multiple cells, hold down the SHIFT key and then click the cells you want to remove. To select all of the cells in the layout, on the Arrange tab, in the Rows & Columns group, click Select Layout.
Right-click one of the selected cells, point to Layout, and then click Remove Layout.
Access removes the selected cells from the layout.
If you left some controls in the layout, they will now overlap with the controls you removed. While the controls are still selected, drag the selected controls away from the layout, being careful not to drop the controls back into the layout.