A
abajo
I'm trying to synchronize two combo boxes, one on my main
form and the second on a sub form. Microsoft's Knowledge
base article 209595 explains how to do this when both
combo boxes are on the same form. Is there a way to do
this when your combo boxes are not on the same form?
Open the sample database Northwind.mdb.
Create a new form not based on any table or query with the
following combo boxes, and save the form as Categories And
Products. Combo Box 1
-------------------------------
Name: Categories
RowSourceType: Table/Query
RowSource: Categories
ColumnCount: 2
ColumnWidths: 0";1"
BoundColumn: 1
AfterUpdate: [Event Procedure]
Combo Box 2
--------------------------
Name: Products
RowSourceType: Table/Query
ColumnWidths: 2"
Width: 2"
Add the following code to the AfterUpdate event procedure
of the Categories combo box:
Me.Products.RowSource = "SELECT ProductName FROM" & _
" Products WHERE CategoryID = " & Me.Categories & _
" ORDER BY ProductName"
Me.Products = Me.Products.ItemData(0)
form and the second on a sub form. Microsoft's Knowledge
base article 209595 explains how to do this when both
combo boxes are on the same form. Is there a way to do
this when your combo boxes are not on the same form?
Open the sample database Northwind.mdb.
Create a new form not based on any table or query with the
following combo boxes, and save the form as Categories And
Products. Combo Box 1
-------------------------------
Name: Categories
RowSourceType: Table/Query
RowSource: Categories
ColumnCount: 2
ColumnWidths: 0";1"
BoundColumn: 1
AfterUpdate: [Event Procedure]
Combo Box 2
--------------------------
Name: Products
RowSourceType: Table/Query
ColumnWidths: 2"
Width: 2"
Add the following code to the AfterUpdate event procedure
of the Categories combo box:
Me.Products.RowSource = "SELECT ProductName FROM" & _
" Products WHERE CategoryID = " & Me.Categories & _
" ORDER BY ProductName"
Me.Products = Me.Products.ItemData(0)