MS Access: Combo Box Basics in Access 2003/XP/2000/97

What is a combo box?

A combo box is a drop-down list of values that the user can select from. Below is a combo box that has been set up to display a list of categories.

Combo boxes generally serve the following purposes.

  1. Standardize the values that a user can enter, since the user is presented with a list of values to choose from.
  2. Make user selections faster and easier.
  3. Allow the user to view multiple columns within a single combo box, providing a vast amount of information at a single glance.

For the purposes of this tutorial, let's take a look at how to create and configure a combo box object.

We've created a form called frmProducts that displays Product ID and Product Name. See picture below.



We've set the form's Record Source property to Products.



Next, select the combo box object from the toolbar and click on the form where you'd like the combo box to appear.

The Combo Box Wizard will most likely appear.



Click on the Cancel button. We'll be configuring the combo box without the help of the wizard.


You should now see your combo box object appear on the form.



Let's begin configuring our combo box.


Name property

We'll set the Name property to CategoryName, since this is the value that we want to display in our combo box.

It's recommended that you set your Name property to something more meaningful. Try not to use the default name that Access gives it, such as Combo0, Combo1, etc.



Control Source property

One of the most important items to configure is the Control Source property.

If you remember, we set the Record Source for our form to the Products table. Now we want to specify what field in the Products table this combo box is bound to.

So we'll set the Control Source property to CategoryName.



Row Source Type property

When configuring the Row Source Type property, there are 3 values to choose from.

  1. The first option is Table/Query. This means that the values for your combo box are populated by a table or query.
  2. The second option is Value List. Your values are not stored in tables, so you "hard code" the values, so to speak.
  3. The third option is Field List. You wish to populate your combo box with an actual list of field names from a table.

For the purposes of this tutorial, we will choose option #1.

We'll set our Row Source Type property to Table/Query.




Row Source property

If you'll remember, we selected the Row Source Type property of Table/Query.

Now need to create a query to populate the combo box values. Click on the button (with the three dots) to the right of the Row Source property.



A Show Table window will appear. Highlight the table that you wish to use in your query and then click on the Add button. Then click on the Close button.



In this example, we've added the Categories table. You should see your table(s) in the Query Builder window.



Next, select the field(s) that you want to display in your combo box. In this example, we want to display the CategoryName, sorted in ascending order.



Click on the X in the top right corner of the Query Builder window.

You should get the following prompt. Click on the Yes button.



Your Row Source property should now contain the SQL statement that you built in the Query Builder. If you wish to edit the query in the future, you can click on the button (with the three dots) to the right of the Row Source property.



Column Count property

The next property is Column Count. This property indicates how many columns so wish to display in our combo box. Since our query that we built only displays the CategoryName, we will set the Column Count property to 1.



Column Widths property

The Column Widths property indicates how wide each column in the combo box will display.

Since we've only selected one column to display (CategoryName), we can leave this property blank.



Bound Column property

The Bound Column property indicates which column to bind to for the control.

If you'll remember, we specified that our combo box is bound to the CategoryName field in the Products table. The Bound Column property tells us which column in our combo box to bind to the CategoryName field.

Since our combo box only displays one column, we set this property to 1.




List Width property

The List Width property tells the combo box how wide to make the drop-down portion of the combo box. If you set this value to Auto, then the combo box will automatically size the drop-down portion.

In this tutorial, we'll set the List Width property to Auto.



Limit To List property

The Limit To List property tells Access whether to allow a user to select a value that is not in the list. This property can either be set to Yes or No.

If the property is set to Yes, then Access will not allow the user to enter a value that isn't in the list. If a user tries to enter a value that is not contained in the combo box, the following message will appear:


The user will be forced to re-select a valid entry from the combo box.

If the property is set to No, then the user can either select a value from the list or enter of value of his/her own.

Please note that if a user enters a value that is not in the list, the value will not be automatically added to the list. This takes more extensive code that will not be addressed in this tutorial.


We've set the Limit To List property to Yes.



Changing caption on label

Now that we've configured our combo box, we'll want to change the caption on the combo box label to something more meaningful.

Currently, the label reads "Combo0".



Select the label object on the form to view its properties. Set the Caption property to "Category Name:"



Viewing our combo box

Now when we view our combo box (as a user would), we can see the category names.



Congratulations! You've just configured your first combo box.