Access Combo box Populate With Table Values

In this article I will explain how you can populate a combo box with values from an Access table.

Consider the following table:
Table

The table name is:

  • “Students”

The table has 5 fields:

  • “ID”
  • “First Name”
  • “Last Name”
  • “Phone Number”
  • “Email”

Consider the combo box below. Assume we want to fill it with data from a field from the table:
Combo box


Step 1:

Open the form in design view, and select the combo box by either clicking on it or selecting it from the the drop down list on the property window:
Select Combo box


Step 2:

Change the Row Source Type to Table/Query:
RowSource


Step 3:

In the Row Source property click on the 3 dot button:
Row Source
The query builder will open. Here you can define a query. The result of this query will populate the combo box. After defining the query click on the close button and save:
Query Builder


Example 1:

Lets say we want to fill the combo box with the first name of the students. After following the 3 steps above, in the query builder create a query that will return the first names of the students from the “Student” table. After creating the Query click on the Close button and save upon closing:
First Names

SQL Statement:

SELECT Students.[First Name]
FROM Students;

Result:
Result


Example 2:

In this example we want the combo box to display the first names of all the students whose ID is between 3100 and 3105:
Example 2

Query Criterion:

[Students].[id]<3105 And [Students].[ID]>3100

SQL Statement:

SELECT Students.[Last Name]
FROM Students
WHERE (([Students].[id]<3105 And [Students].[ID]>3100));

Result:
Example 2 Result

You can download the sample file used in this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *