ACC2000: Base Combo Box on Parameter Query to Filter ValuesID: Q209542
|
This article show you how to filter values that appear in a combo box by basing the combo box on a parameter query.
Sometimes, you may want to limit the values that appear in a combo box. For
example, you may want to show only suppliers whose names begin with a certain letter. Although Access does not allow filters on combo boxes, if you base your combo box on a parameter query, you can filter the values by using a criteria clause.
To create a combo box that displays only the suppliers that meet the criteria that you specify, follow these steps.
CAUTION: Following the steps in this example will modify the sample
database Northwind.mdb. You may want to back up the Northwind.mdb file
and perform these steps on a copy of the database.
Query: Filtered Supplier List
-------------------------------------
Type: Select Query
Field: CompanyName
Table: Suppliers
Sort: Ascending
Criteria: Like [My Criteria Box] &"*"
MacroName: CB Test Macro
------------------------
Action: Requery
ControlName: My Combo Box
Form: TestForm
--------------------------------
Caption: Test Filtered Combo Box
Combo Box
---------------------------------
Name: My Combo Box
RowSourceType: Table/Query
RowSource: Filtered Supplier List
Text Box
---------------------------
Name: My Criteria Box
After Update: CB Test Macro
For more information about creating combo boxes, click Microsoft Access Help on the
Help menu, type "creating and editing combo boxes" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
For more information about creating criteria queries, click Microsoft Access Help on the
Help menu, type "creating criteria queries" in the Office Assistant or the Answer Wizard,
and then click Search to view the topics returned.
Additional query words: limit drop down list box ddb
Keywords : kbusage kbdta FmsCmbo
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: May 14, 1999