| A label is a control that serves as a guide to the user. It provides a static text that the user cannot change but can read to get information about another control on the form or report. You can also use it to display simple information to the user. Most controls on the form or the report are not explicit at first glance and the user would not know what they are. Therefore, you can assign a label to the control as a help to the user. |
To add a label to a form or report, in the Controls section of the Design tab of the Ribbon, click Label

and click on the form or report. Type the text that the label will display and press Enter (as we will see, most controls add their own label to the form or report).
Practical Learning: Introducing Data Controls |
|
- Start Microsoft Access
- From the resources that accompany these lessons, open the Bethesda Car Rental1 database
- On the Ribbon, click Create and, in the Forms section, click Form Design
- Right-click the form and click Form Header/Footer
Probably the most important and the most obvious characteristic of a label is the text it is displaying. The text is the label's caption. If you click the Label control on the Ribbon and click the form or report, you must first define its caption. If a label already has a caption, there are various ways you can edit it. For example, you can double-click it to access its Properties window and edit the string in the Caption field. On the other hand, to edit the caption of a label, on the form or report, click inside the label. That would put it into edit mode and you can edit it as you wish.
The appearance of a label is visibly controlled by its font characteristics. The Font name, also called its face, is the name of the font as defined by the operating system. We saw that there are various ways you can define the font characteristics of a control like the label.
The size of a label control its Width and its Height. Although the dimensions are closely related to the font characteristics, they can be independently defined. There are two main ways you can resize a label, which is equivalent to changing its size. To set your own size, in the Format tab of the Properties window of the label, change the values of the Width and Height properties. Unless you plan to show the background color of a label, probably the best way to resize a label is to make it adjust to the dimensions depending on the font size and the total characters width. To do this, position the mouse on one of the label's handle and double-click. The label's width and height would be set to accommodate its caption.
The position of a label is controlled by its Top and Left properties. The Top property defines the measure from the top left corner of the section where the label is positioned, to the top left corner of the label itself.
Practical Learning: Designing Labels |
|
- In the Controls section of the Design tab of the Ribbon, click Label

- Click the top-left section under the Form Header bar
- Type Bethesda Car Rental - Assets and press Enter
- On the Ribbon, click Home
- While the new label is still selected, in the Text Formatting section of the Ribbon, click the arrow of the Font combo box and select Garamond
- Click the arrow of the Font Size combo box and select 24
- Click the Bold button

- Click the arrow of the Font Color button and click Dark Blue (Standard Colors: 8th column - 7th row).
- To resize the label, position the mouse on one of the handles surrounding the label and double-click

- Click the Form Header bar
- Click the Detail bar
- On the Ribbon, click Home
- In the Text Formatting section of the Ribbon, click the arrow of the Background Color and click More Colors...
- Click Custom and create a color with the following values:
Red: 221
Green: 241
Blue: 255 - Click OK
- Close the form, when asked whether you want to save, click No
In our introduction to the label control, we learned to add a string to a form. To make it act as the title of the form, we had put it in the header section. We also had to remember the name of the form to apply it to the label. Microsoft Access provides a faster means of creating a title. This is done using the Title control. When you do this, Microsoft Access retrieves the name of the form, creates a label, and uses the name of the form as caption.
Instead of going through the label to get a title, to formally create a title, in the Controls section of the Design tab of the Ribbon, click the Title control

and click the form. When you click the form, if it did not have a form header section, that section would be added to the form. If it had the section, that section would be used. Then, a new label with the name of the form as caption would be added to the form header section. When creating this label, Microsoft Access would use some default characteristics, such as the font name and size, and applied them to the label. Of course, you can change any of the characteristics, including the caption of the title.
Practical Learning: Adding a Title |
|
- Open Real Estate Properties1 you modified in Lesson 3
- On the Ribbon, click Create
- In the Forms section, click Form Design
- In the Properties window, click Format and change the following characteristics
Caption: Altair Realtors - Properties
Auto Center: Yes
Record Selector: No
Navigation Buttons: No - In the Controls section, click Title

- As the label is still blinking, type Altair Realtors - Properties and press Enter
- On the Ribbon, click Format
- While the title is still selected, in the Font section of the Ribbon, change the following characteristics:
Font: Georgia
Font Size: 24
Fore Color: Blue
Style: Bold - Right-click the new title -> Size -> To Fit
- To preview the form, right-click its tab (Form1) and click Form View
- Right-click the tab of the form and click Design View
A hyperlink is a label that can be clicked to open an object of the database, an application on the computer, a file from the network, or a web site (or web page). Before using it, the user can position the mouse on the label, which would change the cursor to a pointing finger. The user can click. As stated already, a hyperlink can be made to open almost any type of file or document. When creating it, you will decide what object or file would be opened or accessed.
To create a hyperlink, display a form or a report in Design View:
- Press Ctrl + K
- In the Controls section of the Ribbon, click the Insert Hyperlink control

A dialog box made of various sections would come up. In the left section, you can click Existing File or Web Page:
In this case, if you want to open a file, click Current Folder and use the Look In combo box to specify the folder where the file is located. Once you have specified the folder, in the large list box in the middle-center of the dialog box, locate the file, click it and click OK.
If you want to open a web page, you can choose one of the pages you had previously visited. To do this, in the second column from left, click the Browsed Pages button. All the files that the dialog box can "remember" would display in the list in the middle-center. You can then select the file. You can also click the arrow of the Address combo box to find out if the web site or web page you want is in the list. If you know the web site or the web page you want the link to eventually open, type it in the Address combo box. Once you have specified the file, click OK. This description also applies if you click the Recent Files button.
If you want the link to open an object of the same database, such as a form or a report, in the left column, click Object in This Database. The middle-center of the dialog box would display a tree view. Before selecting an object, expand its node, then select the object, and click OK.
A hyperlink is primarily a label. As such, there are some characteristics you can change for it but you should make sure it would always be obvious to the user that it represents a hyperlink. To change the caption of the hyperlink, you can click it once and click it again to put it into edit mode, and edit its caption. Here is an example:
You can also use the Properties window of the hyperlink to manage the label.
Practical Learning: Adding a Hyperlink |
|
- On the form, click below the Detail bar
- In the Controls section of the Ribbon, click Hyperlink

- In the Link To list of the Insert Hyperlink dialog box, click Object In This Database
- In the main list, click the + button of tables to expand it
- Click Condominiums Text to display text box, replace the text with School Information

- Click OK
- Once again, in the Controls section of the Ribbon, click Hyperlink

- In the Link To list, click Object In This Database
- In the main list, expand the Tables node
- Double-click Single Families
- Once again, in the Controls section of the Ribbon, click Hyperlink

- In the Link To list, click Object In This Database
- In the main list, expand the Tables node
- Double-click Townhouses
- In the Detail section of the form draw a fake rectangle to includes the three hyperlinks
- On the Ribbon, click Format
- Using the objects in the Font section, change the following characteristics:
Font: Bodoni MT Black (if you don't have that font, use another)
Font Size: 24 - Right-click one of the link (they are still selected) -> Size -> To Fit
- On the Ribbon, click Arrange
- In the Table section, click Stacked
- In the Rows & Columns section, click Insert Left
- Again in the Rows & Columns section, click Insert Above

- Right-click the form's tab and click Form View
- Click each of the links to open the corresponding and, after viewing the table, close it
- Close the form
- When asked whether you want to save, click Yes
- Set the name to Real Estate and click OK
In a report meant to display various records on its many pages, you may want to display the page number. To assist you with this, Microsoft Access provides a special label. To get it, display the report in Design View. In the Control section of the Design tab of the Ribbon, click Page Numbers

and click the report. The Page Numbers dialog box would come up:
Use the Page Numbers dialog box to specify what sentence would be used, and where, to display the page number. Once you are ready, click OK. The new label would be added to the Page Footer section of the report.
When displaying a form, if you want to show the current date and/or time, Microsoft Access can assist you with a label. Before creating the label, display the form or report in Design View. To add the label, in the Controls section of the Ribbon, click Date and Time and click the form. The Date and Time dialog box would come up:

Use the dialog box to specify which one of the date or the time, including the formats, would display. Once you are ready, click OK. If the form or report did not have the appropriate header and footer section (the Form Header section for the form and the Report Header section for the report), the section would be created. If the section existed already, it would be used to host the label. When the label is created, by default, it is added to the header section (the Form Header section for the form and the Report Header section for the report). If you do not like those positions, you can move the label(s). To do this, simply click and drag it(them) to the desired section.
A text box is a Windows control used to get or display text for the user's interaction. At its most regular use, a text box serves as a place to fill out and provide information. You can also use it only to display text without allowing the user to change its content.
Like most other controls, the role of a text box is not obvious at first glance; that is why it should be accompanied by a label that defines its purpose. From the user's standpoint, a text box is named after the label closer to it. Such a label is usually on the left or the top side of the corresponding text box.
There are two main ways you can add a text box to a form or report:
- From the Ribbon, you can click the Text Box control
and click a section of the form or report. Unless you have a good alternate reason, most of your text boxes will be placed in the Detail section. Some text boxes used in expressions can be placed in another section. By default, placing a text box on the form or report also adds a corresponding label to its left. - If you drag a text-based field from the Field List and drop it on the form or report, the field would place a text box and its corresponding label.
Like every control on a form or report, the size of a text box is controlled by its Width and Height properties. The position of a text box is controlled by its Top and Left properties.
To make a text box read-only, that is, if you do not want the user to enter text in a text box, there are various alternatives. If you change the Enabled property from Yes to No, the text box would have a gray background and cannot receive focus. If you set the Locked property from No to Yes, the control would appear with a normal (white) background.
The Special Effects properties of the text box are expanded as compared to those available on a label. Besides the ability to raise or sink a text box, you can give it a thick, etched, or shadow border.
After adding a text box to a form or report, you can configure it to receive its data from an existing table. This can be done after the Record Source of a form or report has been defined. To link a text box to the object that is the Record Source of a form or report, click the arrow of its Record Source combo box and select the desired field.
Practical Learning: Adding Text Boxes |
|
- Re-open the Bethesda Car Rental1 database
- On the Ribbon, click Create
- In the Forms section, click Form Design
- Double-click the button at the intersection of the rulers to open the Properties window.
Click the Data tab. Click Record Source. Then click the arrow of its combo box and select CarConditions - In the Controls section of the Design tab of the Ribbon, click the Text Box and click the form
- If the Properties window is not visible, right-click the text box and click Properties.
While the text box is still selected, in the Properties window, click All. Click Name, type txtCarCondition and press Enter - Still in the Properties window, click Control Source. Click the arrow of its combo box and select CarCondition
- Click the label that accompanies the text box
- In the Properties window, click Caption, type Car Condition: and press Enter

- On the form, click the CarCondition text box
- In the Properties window, click Format.
Click Special Effects, then click the arrow of its combo box and select Shadowed

- Close the form
- When asked whether you want to save, click Yes
- Set the name to Car Conditions and press Enter
EmoticonEmoticon