The Command Buttons
To create a button, you can click the Button in the Controls section of the Design tab of the Ribbon and click the desired section of the form. If the Use Control Wizard option is on , the Command Button Wizard would start to help you create a fully functional button. If you don't want to use the wizard, you can click Cancel on the first page of the Command Button Wizard. Also, if you don't want to use the wizard, in the Controls section of the Design tab of the Ribbon, click the More button and click the Use Control Wizards option to dimiss it .
Practical Learning: Creating a Command Button
A Picture on a Command Button
As indicated in the second page of the wizard, a command button in Microsoft Access can display either text or a (small) picture on top. Microsoft Access ships with dozens of pictures you can use, specially made for buttons. If none of these pictures suits your need, you can design your own, using any application of your choice. The picture can have any size you want and it should be saved as a bitmap.
To display a picture on a button, after selecting it in Design View, click the ellipsis button of the Picture field in the Format tab of the Property Sheet, locate the picture, and select it.
The OK and Cancel Buttons
When a dialog box is equipped with an OK and a Cancel buttons, it is suggested that the user be able to press Enter to perform the same action as if he had clicked OK. To apply this behavior, if you create a button and give it an OK caption, you can set its Default property to Yes. It is also suggested that if a button has a Cancel Caption, the user should be able to press Esc and produce the same behavior as if the Cancel button was clicked. To apply this feature, after creating the button with a Cancel caption, set its Cancel property to Yes. Never set the Default and the Cancel properties both to Yes for the same button.
The Style of a Command Button
You can control the appearance and style of a button. To set it, while the form is in Design View and the button(s) is(are) selected, on the Ribbon, click Format. In the Control Formatting section, click Quick Style:
Practical Learning: Specifying the Style of a Button
The Shape of a Command Button
Another aspect you can control on a button is its shape. To apply it, while the form is in Design View and the button(s) is(are) selected, on the Ribbon, click Format. In the Control Formatting section, click Change Shape:
From there, click the desired shape.
A radio button, also called an option button. is a Windows control made of a round box. In practical usage, a radio button is usually (if not always) accompanied by other radio buttons. In other words, radio buttons come as a group. The user makes a decision by clicking one of the round boxes. There are two main ways you can create radio buttons. You can follow the indications from a wizard (which is usually the easier way) or you can manually add the radio buttons.
Before adding radio buttons to your form or report, you must first add a container. To do this, you can use the Option Group control . If a wizard comes up, click Cancel.
To add a radio button to a form or report, in the Controls section of the Ribbon, click the Option Button and click inside the target container on the form or report. Because the round box of a radio button does not indicate what it is used for, it is usually (if not always) accompanied by a label. When you include a radio button, Microsoft Access adds a label to it, to its right. You can change the position of the label to anywhere (to the left, the top, the right, or the bottom side) you want, close to the round box. If you don't like the text of the label, you can change or edit it.
To move or position the round box, click it to select it. Then position your mouse on it to get a 4-arrow cross and drag in the desired direction.
Characteristics of Radio Buttons
If you want to create a group of radio buttons that are tied to a table, in the table, you must create a column that has a natural number as data type.
Because radio buttons work as a group, it is their group box container, not each radio button, that is tied to the column of the table. This means that, after adding an group box to a form or report, set its Record Source to the column of the table.
In the Property Sheet, a radio button has a property named Default Value. This is an incremental value that must be different for each radio button in the group. The first, top or left radio button should have a value of 1, the second should have a value of 2, and so on.
Practical Learning: Adding Radio Buttons
Automatically Generating a Group of Radio Buttons
Microsoft Access provides a means of easily creating a group of radio buttons. This done by following the Option Group Wizard. To use the wizard, make the Use Control Wizard button is on . Among the advantages of using the wizard, it creates the captions of the buttons (you provide the texts), it creates the default value for each radio button, it allows you to select the radio button, and finally it proportionately positions the radio buttons inside the group box.
Practical Learning: Introducing the Group Box
A check box is a control that allows the user to validate or invalidate an option. A check box appears as a little square box. The user makes a decision by clicking in the square, which puts a check mark in the square.
To add a check box to a form or report, in the Controls section of the Ribbon, click the Check Box and click the form or report where you want to position the control.
Practical Learning: Adding a Check Box
Characteristics of Check Boxes
If a check box will receive its value from a table, the corresponding column must use a number-based data type. A check box is used to express a Yes/No value (also called a Boolean value) as true or false. If the value of the record is 0, the check box is unchecked. For any other value, the control is checked.
Sometimes, the decision cannot be made as a definite true or a definite false. To support this eventuality, a check box can assume an intermediate (or indeterminate) value. To provide this functionality, the check is equipped with a property named Triple State. This property is Boolean. If it is set to Yes, the check box can be true (checked), undetermined (dimmed), or false (unchecked).
When you add a check box to a form or report, it is accompanied by a label positioned to its right. The label is used to indicate what the check box is used for, but the label can be moved or even removed from the host. That is, the label can be treated independently.
If you click the check box itself, it becomes surrounded by an orange box. Although you can resize that orange box, you cannot resize the actual check box: it is managed by the operating system.
Practical Learning: Using Check Boxes
A toggle button is a type of button that behaves like a check box. It displays like a command button but behaves like a check box. Also, while a check box should be accompanied by a label that indicates what the check box is used for. A toggle button, like the command button, can display a string on its "face".
To create a toggle button, click the Toggle Button control in the Controls section of the Ribbon and click the form. Like the check box and the radio buttons, there is no wizard to follow.
Practical Learning: Ending the Lesson