K
KBDB
from the Help files........
In 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 selected in the first combo box.
Whenever a category is selected in the first combo box, its AfterUpdate
event procedure sets the second combo box's RowSourceType 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.
Private Sub cboCategories_AfterUpdate()
' Update the row source of the cboProducts combo box
' when the user makes a selection in the cboCategories
' combo box.
Me.cboProducts.RowSource = "SELECT ProductName FROM" & _
" tblProducts WHERE CategoryID = " &
Me.cboCategories & _
" ORDER BY ProductName"
Me.cboProducts = Me.cboProducts.ItemData(0)
End Sub
****
Me.cboCategories is giving the right value
Me.choProducts.RowSource is giving the right query.
But the recordsource is not being updated.
Me.choProducts.ItemData(0) is null
Any Ideals?
In 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 selected in the first combo box.
Whenever a category is selected in the first combo box, its AfterUpdate
event procedure sets the second combo box's RowSourceType 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.
Private Sub cboCategories_AfterUpdate()
' Update the row source of the cboProducts combo box
' when the user makes a selection in the cboCategories
' combo box.
Me.cboProducts.RowSource = "SELECT ProductName FROM" & _
" tblProducts WHERE CategoryID = " &
Me.cboCategories & _
" ORDER BY ProductName"
Me.cboProducts = Me.cboProducts.ItemData(0)
End Sub
****
Me.cboCategories is giving the right value
Me.choProducts.RowSource is giving the right query.
But the recordsource is not being updated.
Me.choProducts.ItemData(0) is null
Any Ideals?