ACC: How to Synchronize Two Combo Boxes on a FormLast reviewed: February 24, 1998Article ID: Q97624 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article describes how to synchronize two combo boxes so that making a selection in the first combo box limits the list of available items 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:
ARTICLE-ID: Q150895 TITLE : ACC95: Microsoft Access Sample Forms Available on MSL ARTICLE-ID: Q175066 TITLE : ACC97: Microsoft Access 97 Sample Forms Available on MSL MORE INFORMATIONThe 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.
REFERENCES:For more information about synchronizing combo boxes, search for "synchronize," and then "synchronizing combo boxes" using the Microsoft Access Help Index.
|
Additional query words: listbox combobox link
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |