Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Cascading Combo Boxes

$
0
0
Good morning! I had posted on another board, but I haven't received any help and would really like to get this working.

Background:
I have a web database in Access 2010 that is based off of the desktop product inventory database template that you can download from within Access.
I have one form to create a purchase order that pulls a list of suppliers from the 'Suppliers' table, manufacturer information from the 'Manufacturers
table, and product information from the 'Products' table. What I am trying to accomplish is when adding a line item (product to purchase), you choose the supplier at the top of the main form which limits the manufacturers in the subform that the supplier has which then limits the available part numbers in the last box. I have attached a screenshot to make this more clear. The issue is that there isn't a manufacturer field in the suppliers database, so there isn't a direct way to accomplish what I want.

Problem:
By default in the template, you can't select a Manufacturer or anything in the subform until you choose a supplier. The fields are locked through an AfterUpdate expression in the suppliers combo box. Once I choose the supplier, the subform unlocks (well, most of it). For some reason, after choosing a supplier, I can choose a product that the supplier carries but I can't choose a manufacturer first. The list appears, but I can't click on anything. If I choose a product, though, the Manufacturer Name field populates with the corresponding manufacturer.

How can I make it so that the manufacturer combo box is limited by the supplier combo box, and the products combo box is limited by the manufacturer combo box?

Please let me know if I need to explain something else or if you need more information. Thanks in advance for any help!

Combo Box Details:

Supplier Combo Box: (Main Form)
Control source - 'SupplierID'
Name - 'cboSupplierID'
Row Source -
Code:

SELECT Suppliers.ID, Suppliers.Company FROM Suppliers ORDER BY Suppliers.Company
After Update - See attached "cboSupplierID-AfterUpdate1.png" "cboSupplierID-AfterUpdate2.png"

Manufacturer Combo Box: (Sub Form)
Control source - 'ManufacturerName'
Name - 'cboMFGID'
Row Source -
Code:

SELECT [Manufacturers].[ID], [Manufacturers].[Company] FROM Manufacturers ORDER BY [Company];
Product Combo Box: (Sub Form)
Control source - 'ProductID'
Name - 'cboProductID'
Row Source:
Code:

SELECT Products.ID, Products.ProductName FROM Products WHERE [SupplierID]=[Forms]![PurchaseOrderDetail]![cboSupplierID] ORDER BY Products.ProductName;
After Update - See attached image "cboProductID-AfterUpdate.png"


Viewing all articles
Browse latest Browse all 13329