Combo Box controls in Microsoft Access. Combo box
controls provide a flexible form control feature for making data entry
consistent and user friendly. Here we provide an overview of our combo box form control
programming examples.
Our goal is to offer you information
required to create efficient Access databases. At the same time we hope that you'll consider
our services for
your next project or you might hire us for
hourly consulting
to help you with programming tasks on your current project.
Access Combo box and lookup lists are all synonyms for
basically the same GUI control. The combo box control is used in nearly
all programming languages include: HTML, Excel, Java, net, ASP, etc.
Use the navigation links on the right side
of this page to see each example in detail. Below you will find excerpts from each of VBA combo box
control
examples.
Initially, a combo box control displays a single entry
which is typically either the default value, nothing, or the previously selected
choice from the list. The drop
down feature is activated when the user clicks the down arrow which is located
on the left or right side of the control.
Combo boxes usually show several choices at one time with the selected or default choice highlighted in some manner.
All of our examples use Visual Basic, VBA, VB, VB script code. We don't
use macros.
These form controls normally provide two functions:
In these programming examples we refer to the following controls interchangeably in Microsoft Access:
Dropdown Box
List Box
Combo Box
Lookup Lists
Dropdown List Box
Value List
An Access combo box looks simple on a data entry
screen.
However, these controls combine nearly all aspects of database programming including table
design, Visual Basic, query design, and finally the user interface design. They are probably the most complex
(seemingly simple)
of the Access database form controls.
Our developers have put together the
following excerpts from our examples to show you a variety of Access database
combo box techniques.
Yes/no Drop Down
List
The simplest dropdown list box - the yes/no field. Create a fiel
d
(text) in your table with a field length of one character. Create a validation
rule that specifies in ("Y","N"). It is best to leave out a lookup table
definition. Not adding lookup definitions is important to the performance
and flexibility of your database.
Table-based
Access Combo Box
Lookup lists based on values stored in a table. It is pretty simple to
setup and provide you and your users with the flexibility to
add new list items as necessary and that is how 95% of MS Access
users/developers setup a combo box. This method will work great for small
databases containing less than 1,000 records...However.
Access Combo Box:
All/Any Choice
Add choice to a table-based list using union query. Start by se
ting
up a dropdown lookup list using table as the row source with ' All' added to the
item list. This All query setup is used to provide with user ability to choose
a specific item in the list or select All records. This is most useful for
setting up report criteria. A Union query is used to add the All
selection. This concept can be expanded to provide for other choices such
as None. Here we assume you are familiar with our Microsoft Access
table database design
guidelines.
Lookup
List-Correct Way
Lookup list table design & index pointers.
The autonumber ID field makes the database compact, efficient, and reliable. It
also eliminate the need for cascading updates in the relational table design -
this will tend to speed up the database a little.
Fill In
Other Form Fields
Filling in a text field from a combo box. Expanding upon
a previous example, suppose that we have account numbers associated with each
shipping method and that these account numbers (for whatever reason) can change
over time. Therefore we want to save the account number in the shipping record.
Best Way to
Fill Form Field
A better way to fill text field from a multi-field combo box.
Dependent Combo Box List
Dropdown List box dependent on another form field. Changing the controls source programmatically - parameterized query
Filter Access Combo Box
Filtering lookup lists - Access combo box example two
Database Combo Box Lists
in One Table
Combining many lookup tables into one table - advance table and query design
Speed Up Form Combo Box Lists
Speed up slow drop down list box activation time - advanced VB Script
You can find more information on
programming lookup lists
on Microsoft's website.