To design a form or a report or to change the existing design of a form or report, you must display it in an appropriate setting called the Design View.
To display a form or a report in Design View:
As mentioned previously, you can create a form whose data come from a table or you can create a form that is not meant to display data.
When designing a form or a report, one of the objects you will regularly use is called the Properties window. To get the Properties window of the properties associated with a control, while the form or report is in Design View, right-click the object and click Properties. To display the Properties window for the form or the report in Design View:
Any of these actions would display the Properties window. The Properties window is dockable. This means that you can drag its title bar and position it either in the middle of the screen or to the left or the right side of the screen:
There are various ways you can close or hide the Properties window:
The title bar of the Properties window displays the Property Sheet string. Under the title bar, a label identifies the type of object whose characteristics the Properties window is displaying. Under the label, there is a combo box that displays the name of the object whose characteristics are displayed in the Properties window:
To change the object whose properties you want to access:
The Properties window is made of five property pages or tabs: Format, Data, Event, Other, and All. The tabs display the characteristics associated with the object or the control that is selected on the screen or in its top combo box. To access a tab, you can simply click it.
Each tab is made of two sections devided by a vertical line. To make one section wider than the other, position the mouse on the dividing line and drag left or right:
In order to change a property, first open the table, the form, or the report in Design View, click the object whose property you want to change. In the Properties window, locate the property you want to change and click it. Each field in the Properties window is divided in two sections: its name and its value:
The left column of a tab in the Properties window displays the names of properties. Although you can click a property name to select it, you cannot change it. The property name can be made of one word such as Width. It can also be made of a combination of words, such as Border Style. Regardless, in our lessons, each property will be called by what displays on that left column. This means that, if a property displays "Width", we will call it "The Width Property". If it displays "Allow PivotTable View", we will call it "The Allow PivotTable View Property".
The right column of a tab of the Properties window displays the value of the property.
There are values types of properties:
String-Based Properties: Some values of properties can be made of one or more characters or words. Here is an example:
To change the value of a string property:
Numeric Properties: A property is numeric if it must hold an integral or decimal value. An integer is a natural number that does not take a decimal portion. Such a number can be made of digits only. For such a field, make sure you provide an integer of appropriate range, as you will be directed to do. Here is an example:
A decimal number, also called a floating-point number, can be made of digits or a combination of digits and one period (or the symbol used as the decimal separator in your language; you can find this out in the Regional Settings of the Control Panel) in between. Here are examples:
When setting such a value, make sure that either you
type only digits, or you type digits and one decimal separator. The
decimal separator can be anywhere in the value, Microsoft Access would
take care of formatting it if it judges it necessary.
Some numeric properties, such as the color properties, allow you to either type a number (provided you know what number you want to use) or to use an intermediary approach (namely a dialog box) to select an appropriate value.
Expressions Properties: Some properties are made of a combination of specific characters and digits. Examples are the format of a date or time, the concatenation of strings to produce another string. To specify the expression, you can use the same approach we described for a string. After entering the expression, Microsoft Access would analyze it. If you respect the rules of the type of expression you are supposed to create, it would be used. If you enter a wrong expression or Microsoft Access cannot identify what the expression would produce, you may get either an error or an unpredictable result.
Boolean Properties: A property is referred to as Boolean if it can have only either a Yes or a No value, an On or an Off value, a 0 or no 0 value. Both values of the property are stored in a combo box. Here are examples:
To change the value of Boolean property:
Enumerated Properties: Some properties provide a list of options as the possible values of the property. The list, which cannot be changed, comes as a combo box from where you can select one item. To change the value of an enumerated property:
Action-Based Properties: Some properties need a value that may be gotten from an external object or another application. In the Properties window, such properties show an ellipsis button:
When you click the ellipsis button, a dialog box or a window may come up. You will be directed as to what to do. If the database already has one or more values that can be used, you can click the arrow of the combo box and select from the list.
To populate a form or a report, you will use various objects called Windows controls or simply, controls. These are the objects a user of your database uses to interact with your product. The objects are available in the Ribbon when the form or report is in Design View. To access the controls, you can click Design on the Ribbon. The controls are listed in the Controls section. By default, the primary controls appear in one row:
If you resize the Ribbon to a size that cannot show all controls, the Controls section would be made into two or more rows and the right section would be equipped with three buttons. To show the hidden object, you can click the down-pointing arrow:
To show all controls at once, you can click lowest of the three buttons:
In our lessons, we will mostly use controls listed in the Controls section of the Ribbon. If they are not enough, to access more controls, you can click the ActiveX Controls button. This would bring the Insert ActiveX Control dialog box from where you can select a control:
After selecting the desired control, you can click OK.
The Windows controls are represented with small icons in the Controls section. Each item is identified with a name. Some of these objects may not be familiar to you. To know the name of a control and have an idea of what it is used for, you can position the mouse on top and a tool tip would appear. Here is an example for an option group:
For the rest of our lessons, each control will be referred to by the name that displays from the tool tip.
To select a control, you can click it in the Controls section. Once a control, such as the button , has been clicked, it becomes highlighted . If you clicked a control by mistake but want to use another, you can click that other control. If you clicked a control but do not want to use any, you can click the Select button that is used to dismiss any selected control.
There are various techniques you can use to add a control to your form or report:
Some controls are meant to assist you with performing an action on the form or report. To make this possible, the Controls section is equipped with a Use Control Wizards button . To access it, click the bottom arrow button on the right side of the Controls section:
If the control is set to perform an action, to use that action, the Use Control Wizards button must be selected or highlighted . In this case, if you click a control and click the form or report, a wizard would come up and you can use it to configure the desired behavior. We will see examples in other sections and lessons. In some cases, you will not want to use the wizard. For this reason, you should always check whether the Use Control Wizards button is not selected . You can click it to put it up to make sure the control's action is not launched.
To assist you with design, a form or a report in Design View is equipped with two rulers, one horizontal in the top section and one vertical in the left section. Since the rulers are dimensionally configured, there are divisions inside of the rulers to assist you with some precision.
Between two numbered dimensions, there are 7 marks that create 8 divisions. The mark in the middle, a little taller than the others, represents the middle of two dimensions. In our lessons, the middle division will be referred to as half. The first division on the right side of a number represents 1/8 of a dimension, the 2nd represents 2/8 of a dimension, the 3rd represents 3/8, and that is why the 4th represents 4/8. This is how we will refer to these dimensions.
The rulers can be very useful during control design. If you do not want to use them, you can remove or hide them. To do this:
Here is an example of a form in Design View without the rulers:
Because you can ignore the rulers during design, you should leave them on.
To assist you with setting the characteristics of a control, a form or a report in Design View is equipped with grid lines on its body:
If you do not want to use the grid lines, to remove or hide them:
Here is an example of a form in Design View without the grid lines:
As we will see in the next sections, you should display the grid lines because you can ignore them during design.
In Lesson 3, we saw that you could automatically generate a form or a report using data from a table. In this lesson, we have seen how to add controls from the Ribbon to a form or report. By default, the controls from the Ribbon are not related to any data of a table. When working on a database, most of the controls you will use are meant to display data. When starting a form or report or while designing it, if it is meant to display data from a table, you must specify it.
While designing a form or report unrelated to a table, if you decide that it must display data, you can specify the table that holds that data. To do this, while in Design View, you can display the Properties window for the form or report. Then, click the arrow of the Record Source combo box and select a table. Here is an example:
After specifying the Record Source of a form or report, the controls positioned on it, if any, are ready to show the values stored in the table. To make this happen, you can first add unrelated controls, as we saw earlier, to the form or report, then "link" those controls to the columns of the Records Source's table. Microsoft Access provides another technique.
Besides the Properties window that we introduced earlier, another window that can assist you when designing a form or a report is called the Field List. This window is useful only if the form or the report is meant to display data from a table, that is, if the form or report is not an unrelated object.
The Field List is a window that holds the names of columns from the table specified as the Record Source. To display the Field List, while the form or the report is in Design View, on the Ribbon, click Design and, in the Tools section, if the Add Existing Fields button is highlighted , this indicates that the Field List is already displaying. Otherwise, you can click it . This would open the Field List. Like the Properties window, the Field List is dockable, meaning you can move it around the screen, and you can position it either to the left or to the right sides of the Microsoft Access interface.
The Properties window and the Field List share the same window location. Consequently, when one is displaying, the other closes, and vice versa. Based on this, to display the Properties window, you can either double-click the button at the intersection of the rulers or you can click the Property Sheet button in the Tools section of the Design category of the Ribbon. If the Field List was displaying, it would be replaced by the Properties window. To display the Field List, as mentioned already, in the Tools section of the Design category of the Ribbon, you can click the Add Existing Field button . If the Properties window was displaying, it would be closed and replaced by the Field List.
If you open the Field List for an unrelated form or report, that is, a form or report whose Record Source is empty, the Field List would appear blank:
If the Record Source of the form or report is already specified, the Field List would show the list of the columns of the base table. Here is an example:
When the Record Source of a form or report has been specified, by default, the Field List displays only the columns of its base table. Still, the Field List is equipped to show the columns of the various tables of the current database. To show the columns of the other tables, on the Field List, you can click the Show All Tables button.
When designing a form or a report, one of the most usual actions you will perform consists of inserting items from the Field List to the form or the report. To add a field, you can drag it from the Field List to the form or report. To drag many fields at the same time, first select them.
To select all items at the same time on the Field List, you can click the item on one end of the list, press and hold Shift, and click the item on the other end. In fact, you can use this same technique to select fields in a range.
To select fields at random, press and hold Ctrl, then click each one of the desired fields. If you had selected an item but want to remove it from the selection. While still holding Ctrl, you can click the undesired item.
To add one item to the form or report, you can drag it from the Field List and drop it on the form or the report. Alternatively, you can double-click it from the Field List and it would be positioned in the body of the form or report.
To add a group of items, first select them from the Field List, then drag the selection and drop it on the form or report.