Article ID: 289670 - View products that this article applies to.
This article was previously published under Q289670
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
For a Microsoft Access 2000 version of this article, see 209595
For a Microsoft Access 97 version of this article, see 97624
This article describes how to synchronize two combo boxes so that when you select an item in the first combo box, the selection limits the choices in the second combo box.
Note This article explains a technique that is demonstrated in the sample file, FrmSmp00.mdb. For additional information about how to obtain this sample file, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/233324/ )ACC2000: Microsoft Access 2000 Sample Forms Database Available in Download Center
The following example uses the sample database Northwind.mdb. 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:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
NotesIn this example, the second combo box is filled with the results of an SQL statement. This SQL statement finds all the products that have a CategoryID that matches the category that is selected in the first combo box.
Whenever a category is selected in the first combo box, the AfterUpdate property runs the event procedure, which sets the second combo box's RowSource property. This refreshes the list of available products in the second combo box. Without this procedure, the contents of the second combo box would not change.
Article ID: 289670 - Last Review: January 31, 2007 - Revision: 7.2
Contact us for more help