6
= Copyright © 2011 by Pearson Education Inc. publishing as Prentice Hall. All rights reserved. From Skills for Success with Microsoft® Access 2010 Comprehensive Create Forms | Microsoft Access Chapter 3 More Skills: SKILL 12 | Page 1 of 6 A combo box is a control that has a text box 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. Access CHAPTER 3 More Skills 12 Add Combo Boxes to Forms Figure 1 One section in main form Registered students in subform

9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

=

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

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

� A combo box is a control that has a text box 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 assistwith 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 AccessChapter 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 screenwith Figure 1.

The form has a form and subform. The main form shows each scheduled class, and thesubform is used to enter students into sections.

AccessCHAPTER 3

More Skills 12 Add Combo Boxes to Forms

Figure 1

One section inmain form

Registeredstudents in

subform

Page 2: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

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

3. In the subform append row, click the Student ID text box, and then type 1188—theStudent ID for Scotty Kats.

Registering a student into a section by typing the Student ID value requires previousknowledge of the student’s ID—a value currently not displayed on the form.

4. On the Home tab, in the Views group, click the View button arrow, and then click DesignView.

5. In the subform, click the Student ID text box to select it, and then press X to remove thecontrol and its label.

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 theRegistration ID. Compare your screen with Figure 2, and then click one time to insert thecontrol and start the Combo Box Wizard.

The exact position of the control inserted in the subform does not matter. Recall thatsubforms typically display in Datasheet view. Here, the control will display as a columnin the subform datasheet.

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

Figure 2

Combo Boxbutton

Insert ComboBox pointer

Controls Morebutton

Page 3: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

7. In the Combo Box Wizard, be sure the I want the combo box to get the values fromanother 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 screenwith Figure 3.

The combo box will use the Student ID to look up the student name values from theStudents table.

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

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

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

Figure 3

Three fields fromStudents table

will displayin combo box

Page 4: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

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 theStudents table.

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

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

Figure 4

Values fromStudents table

Option to hideprimary key

values cleared

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

Page 5: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

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

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

Figure 5

Student IDselected

Option willstore Student

ID value

13. Select the Store that value in this field option button, click the arrow, and then clickStudent ID. Compare your screen with Figure 5.

A combo box can be used to select one value, and store a corresponding value in atable. Here, when a student name is selected in the combo box, the correspondingStudent ID will be stored in the Student ID field in the Registrations subform.

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

Page 6: 9780135088357 ACS C03 MS12 - Pearson Educationwps.prenhall.com/.../9780135088357_ACS_C03_MS12.pdf · Save the database in your Access Chapter 3 folder as Lastname_Firstname_a03_Registrations

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

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

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

Figure 6

Combo boxarrow

Combo box list

16. In the combo box list, click Lionel Barahana, and then notice that his Student ID is enteredinto the form.

17. With the field just added still active, create a Full-screen Snip. Save the snip in your AccessChapter 3 folder as Lastname_Firstname_a03_Registrations_Snip Close the Snipping Toolwindow.

18. Close the form, and then Exit Access. Print the snip or submit your files as directed byyour instructor.

� You have completed More Skills 12