
Update a data combo based on selection in other data combo
You can do it by setting the recordsource for the second datacombo on the
lostfocus or change event on the first datacombo.
In the lostfocus event do the following:
SQLStmt = "SELECT SubcategoryTitle FROM SubCategory Where CategoryTitle = '"
& cboCategory.Boundtext & "'"
rsSubCat.Open SQLStmt, Connection, adOpenStatic, adLockReadOnly
Set cbosubCategory.RowSource = rsSubCat
To display multiple fields in a datacombo, the fields need to be
concatenated into a single string. Not really worth it.
Hope this helps.
Suzette
Quote:
> Can you update a data combo based on selection in another data combo? If
so,
> how? I have a Category Table and a Subcategory Table I have put an ADODC
> control for each on a form. After the user selects which Category he wants
> from a data combo for Category, I want only the other the
SubcategoryTitles
> for the chosen category to appear in the box.
> Category Table Fields:
> CategoryKey (Autonumber) [bound column in cboCategory data combo box]
> CategoryNumber
> CategoryTitle (This is the field I want to show in the cboCategory
box,
> though if you know a way to show both CategoryNumber and CategoryTitle
> together in a data combo, that would really be cool
> Subcategory Table Fields:
> SubcategoryKey (Autonumber) [bound column in cboSubcategory data combo
> SubcategoryCode
> SubcategoryTitle