Locked lesson.
About this lesson
Add option buttons to the form.
Exercise files
Download this lesson’s related exercise files.
13.01 form-controls-option-buttons - Exercise.docx43.3 KB 13.01 form-controls-option-buttons - Exercise solution.docx
85.4 KB TechGurusTicketing30.accdb
1.6 MB TechGurusTicketing30 - Complete.accdb
1.6 MB
Quick reference
Form Controls: Option Buttons
Add Option buttons to the form.
When to use
We add option buttons to a form whenever we want to specify the ticket as being part of a category or group.
Instructions
In this example, we need to add an option group containing three option buttons to categorize this ticket as hardware, software, or other.
Option Group
An option group contains the different option buttons. We can add option buttons using the form wizard. Access numbers the different options. For example, hardware=1, software=2, other=3. We use the numeric values of each option to categorize the tickets.
Adding the Category Field
First, we need to add the category field to 'tblTicket'.
- Open ‘tblTicket’.
- Add a new field with the following properties:
- Name: Category
- Data Type: Short Text
- Description: Category for this ticket
- Field Size: 30
- Required: Yes
- Allow zero Length: No
- Indexed: Yes (Duplicates OK)
- Switch to Datasheet View.
- In the ‘Category’ field, add a number 1, 2, or 3 to every record in the table.
Add Options Buttons
Now we need to add the form control to 'frmTicketMaintenance'.
- Add Option Buttons to ‘frmTicketMaintenance’ with the following properties
- Option 1 - Hardware
- Option 2 - Software
- Option 3 - Other
- From the Form Design tab, in the Form Controls group, select the Option Group form control.
- Draw the control on the form.
- Step through the Option Group Wizard.
- Type the labels ‘Hardware’, ‘Software’, and ‘Other’.
- Click Next.
- Choose ‘Hardware’ as the default value.
- Accept all defaults.
- Add the caption ‘Category’.
- Click Finish.
- Arrange the fields on the form.
- Click on the form control group.
- From the Property Sheet, in the Control Source drop-down, select ‘Category’.
- Switch to Form View and check the buttons are working.
Lesson notes are only available for subscribers.