Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
ACC: How to Synchronize Two Combo Boxes on a Form
Article ID: 97624 - View products that this article applies to.
This article was previously published under Q97624
Moderate: Requires basic macro, coding, and interoperability skills.
This article shows you how to synchronize two combo boxes so that when you make a selection in the first combo box, the selection limits the choices in the second combo box.
NOTE: This article explains a technique demonstrated in the sample files, FrmSampl.exe (for Microsoft Access for Windows 95 version 7.0) and FrmSmp97.exe (for Microsoft Access 97). For information about how to obtain these sample files, please see the following articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/150895/EN-US/ )ACC95: Microsoft Access Sample Forms Available in Download Center
(http://support.microsoft.com/kb/175066/EN-US/ )ACC97: Microsoft Access 97 Sample Forms Available in Download Center
The following example uses the sample database Northwind.mdb (NWIND.MDB in earlier versions). The first combo box lists the available product categories, and the second combo box lists the available products for the category selected in the first combo box:
NotesIn the above example, the second combo box is filled with the results of the Category Combo Query query. This query finds all the products that have a CategoryID that matches the category selected in the first combo box.
Whenever a category is selected in the first combo box, the AfterUpdate property runs the Refresh Products macro, which forces the second combo box to run the Category Combo Query query again. This refreshes the list of available products in the second combo box. Without this macro, you would have to force the second combo box to refresh itself by pressing the F9 key.
Important: If the first combo box is bound, you should also assign the Refresh Products Macro to the On Current event of the form.
For more information about synchronizing combo boxes, search for "synchronize," and then "synchronizing combo boxes" using the Microsoft Access Help Index.
Article ID: 97624 - Last Review: January 18, 2007 - Revision: 2.1