<<

2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 1

CHAPTER= 3 Access

More Skills 12 Add Combo Boxes to Forms

᭤ A combo box is a control that has a and a list that is hidden until you click its arrow. ᭤ Combo boxes can display values from a related table and are often added in forms to assist with data entry.

To complete this database, you will need the following file: ᭿ a03_Registrations

You will save your files as: ᭿ Lastname_Firstname_a03_Registrations ᭿ Lastname_Firstname_a03_Registrations_Snip

1. Start Access, and then open a03_Registrations. Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations If necessary, enable the content. 2. In the Navigation Pane, double-click Registration Form, and then compare your screen with Figure 1. The form has a form and subform. The main form shows each scheduled class, and the subform is used to enter students into sections.

One section in main form

Registered students in subform

Figure 1

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 1 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. 2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 2

3. In the subform append row, click the Student ID text box, and then type 1188—the Student ID for Scotty Kats. Registering a student into a section by typing the Student ID value requires previous knowledge of the student’s ID—a value currently not displayed on the form. 4. On the Home , in the Views group, click the View arrow, and then click Design View. 5. In the subform, click the Student ID text box to select it, and then press X to remove the control and its . 6. On the Design tab, in the Controls group, click the More button, and then click the Combo Box button. Place the pointer approximately two grid dots below the Registration ID. Compare your screen with Figure 2, and then click one time to insert the control and start the Combo Box Wizard. The exact position of the control inserted in the subform does not matter. Recall that subforms typically display in Datasheet view. Here, the control will display as a column in the subform datasheet.

Combo Box button

Controls More button

Insert Combo Box pointer

Figure 2

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 2 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. 2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 3

7. In the Combo Box Wizard, be sure the I want the combo box to get the values from another table or query option box is selected, and then click Next. 8. Under Which table or query should provide the values for your combo box, click Table: Students, and then click Next. 9. Move Student ID, First Name, and Last Name into Selected Fields. Compare your screen with Figure 3. The combo box will use the Student ID to look up the student name values from the Students table.

Three fields from Students table will display in combo box

Figure 3

10. Click Next. Under What sort order do you want for the items in your , click the arrow, and then click Last Name.

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 3 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. 2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 4

11. Click Next. Clear the Hide key column check box. Compare your screen with Figure 4. The combo box will use the Student ID to look up the student name values from the Students table.

Option to hide primary key values cleared

Values from Students table

Figure 4

12. Click Next. Be sure that under Available Fields, Student ID is selected, and then click Next.

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 4 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. 2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 5

13. Select the Store that value in this field option button, click the arrow, and then click Student ID. Compare your screen with Figure 5. A combo box can be used to select one value, and store a corresponding value in a table. Here, when a student name is selected in the combo box, the corresponding Student ID will be stored in the Student ID field in the Registrations subform.

Option will store Student ID value Student ID selected

Figure 5

14. Click Next, and then under What label would you like for your combo box, type Student

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 5 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. 2140004Access_C03_MS12.qxd 6/29/10 1:43 PM Page 6

15. Click Finish, click Save , and then switch to Form view. In the subform append row, click the Student ID field, and then click the displayed combo box arrow. Compare your screen with Figure 6.

Combo box list

Combo box arrow

Figure 6

16. In the combo box list, click Lionel Barahana, and then notice that his Student ID is entered into the form. 17. With the field just added still active, create a Full-screen Snip. Save the snip in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations_Snip Close the Snipping Tool . 18. Close the form, and then Exit Access. Print the snip or submit your files as directed by your instructor. ᭿ You have completed More Skills 12

Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 6 of 6

From Skills for Success with Microsoft® Office 2010 Vol. 1 Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved.