21
10 Create a list of choices Access 2007 provides two list controls – the list box and the combo box. List Box: The list box control displays a list of values or choices. Combo box: The list of combo box is hidden until you click the drop-down arrow.

Chapter 10 - Advanced Forms Design

Embed Size (px)

Citation preview

Page 1: Chapter 10 - Advanced Forms Design

10 Create a list of choices

Access 2007 provides two list controls – the list box and the combo box.

List Box: The list box control displays a list of values or choices.

Combo box: The list of combo box is hidden until you click the drop-down arrow.

Page 2: Chapter 10 - Advanced Forms Design

10.1 Create a list box by using a

wizard

Suppose we have the following data in the Book table

And we want to create a form to list the book name from selecting the book author in the list control.Suppose we have a form like this

Page 3: Chapter 10 - Advanced Forms Design

Make sure you are in the Design View of the form. The following steps will show you how to create a list box or a combo box.

Here I click the List Box tool as an example. Then click on the form area where you want the List Box / Combo Box to be placed.

1) Ensure the Use Control Wizards is selected

Combo Box

List Box

2) Click either the List Box tool or the Combo Box tool.

A List Box Wizard / Combo Box Wizard is displayed.

3) Choose this

5) Choose BookAuthor 6) Click it

Page 4: Chapter 10 - Advanced Forms Design

And you will see the BookAuthor appears in the Selected Fields.

7) Next

8) Tick “Hide key column to hide the Primary key

Page 5: Chapter 10 - Advanced Forms Design

You can see a list control is created in the Design View of the form now.

9) Give a label to the list box

10) Finish

Page 6: Chapter 10 - Advanced Forms Design
Page 7: Chapter 10 - Advanced Forms Design

Now open the Book form, you will see the result.Whenever you click the BookAuthor name, the corresponding BookName and BookID will be displayed.

Page 8: Chapter 10 - Advanced Forms Design
Page 9: Chapter 10 - Advanced Forms Design

10.2 Create a combo box by using a

wizard

Suppose we have another new form called Book_form2.

1) On the Design tab, in the Controls group, ensure that Use Control Wizards is

selected.

2) Click the Combo Box tool.3) On the form, click where you want to place the combo box.

Page 10: Chapter 10 - Advanced Forms Design

4) Click this

5) Next

6) Click this

7) Next

Page 11: Chapter 10 - Advanced Forms Design

8) Tick Hide key column

9) Next

10) Give a label to the combo box

11) Finish

Page 12: Chapter 10 - Advanced Forms Design

Save it as Book_form2 and open it, you will see a combo box is created.

Page 13: Chapter 10 - Advanced Forms Design

10.3 Setting Combo Box Properties

Manually

Go to the Design View of Book_form2, right click the Combo Box you have just created and select properties.

Page 14: Chapter 10 - Advanced Forms Design

1) Select Yes in the Column Heads

2) Change to “7cm” in the List Width

Page 15: Chapter 10 - Advanced Forms Design

Then save it and open the Book_form2 again. You will see there are column headings above the values and the list width is widened.

Page 16: Chapter 10 - Advanced Forms Design

10.4 Adding a Subform with the

Wizard

Suppose we have the following relationships.

1) Click Create 2) Click More Forms

3) Click Form Wizard

Page 17: Chapter 10 - Advanced Forms Design
Page 18: Chapter 10 - Advanced Forms Design

Select the following fields according to the steps shown below:

Page 19: Chapter 10 - Advanced Forms Design

1) Next

2) Select by User

3) Select Form with subform(s)

4) Next

Page 20: Chapter 10 - Advanced Forms Design

5) Select Tabular

6) Next

7) Choose a style you like

8) Next

Page 21: Chapter 10 - Advanced Forms Design

A Subform is created and you can now check the Borrow record for each User.

9) Enter a name for the main Form

10)Enter a name for the subform

11) Finish