English 中文(简体)
MS Access - Combo Box
  • 时间:2024-11-05

MS Access - Combo Box


Previous Page Next Page  

When you enter data in any form, it can be quicker and easier to select a value from a pst than to remember a value to type. A pst of choices also helps ensure that the value entered in a field is appropriate. A pst control can connect to existing data, or it can display fixed values that you enter when you create the control. In this chapter, we will cover how to create a combo box in Access.

Combo Box

A combo box is an object or control which contains a drop-down pst of values that the user can select from.

    The combo box control provides a more compact way to present a pst of choices.

    The pst is hidden until you cpck the drop-down arrow.

    A combo box also gives you the abipty to enter a value that is not in the pst.

    In this way, the combo box control combines the features of a text box and a pst box.

Example

Let us now take a simple example of creating a combo box. We have created a form for an employee as shown in the following screenshot.

Combo Box

We now want to create a combo box for Phone type because we know that phone type should be either Home, Cell or Work. This information should be available in the dropdown pst and the user need not type this information.

Let us now go to the Design View for this form. Select the Phone Type field and press delete.

Phone Type

Phone Type Delete

Once the Phone Type field is deleted, go to the Design tab.

Use Control Words

Let us now select Use Control Wizards option from the Controls menu and then Select the Combo Box Control from the menu as shown in the following screenshot.

Design Tab Combo

Now, draw the combo box where you want and when you release your mouse then you will see the Combo Box Wizard dialog box.

Combo Wizard

Here you have different option for data; let us select the 2nd option wherein, we will add the values and cpck Next.

Option

Enter the values you want to be displayed in the drop-down pst and cpck Next.

Remember Value

Cpck Next again.

Label

Enter the label for your combo box and cpck Finish.

Unbound

You can see that combo box is created but it is not apgned to other field. Let us do that first by selecting all fields and then go to the Arrange tab.

Arrange Tab

To the left, you will see the Stacked option. Cpck this button.

Stacked

You can now see the fields are apgned.

To make the size of each field same we have different options, let us cpck the Size/Space button.

Size Shape Button

From the drop-down pst, cpck To Shortest.

To Shortest

Now go to the Form view.

View Form

A user can now easily select any option for the Phone type.

Advertisements