MS Access - Combo Box
When you enter data in any form, it can be quicker and easier to select a value from a list than to remember a value to type. A list of choices also helps ensure that the value entered in a field is appropriate. A list 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.
A combo box is an object or control which contains a drop-down list of values that the user can select from.
- The combo box control provides a more compact way to present a list of choices.
- The list is hidden until you click the drop-down arrow.
- A combo box also gives you the ability to enter a value that is not in the list.
- In this way, the combo box control combines the features of a text box and a list box.
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.
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 list 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.
Once the Phone Type field is deleted, go to the Design tab.
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.
Now, draw the combo box where you want and when you release your mouse then you will see the Combo Box Wizard dialog box.
Here you have different option for data; let us select the 2nd option wherein, we will add the values and click Next.
Enter the values you want to be displayed in the drop-down list and click Next.
Click Next again.
Enter the label for your combo box and click Finish.
You can see that combo box is created but it is not aligned to other field. Let us do that first by selecting all fields and then go to the Arrange tab.
To the left, you will see the Stacked option. Click this button.
You can now see the fields are aligned.
To make the size of each field same we have different options, let us click the Size/Space button.
From the drop-down list, click To Shortest.
Now go to the Form view.
A user can now easily select any option for the Phone type.