makai
Aug 31st, 2000, 12:02 PM
Data1 and Data2 Controls both have the same Databasename
there are two tables in the database
one table named categories has
CategoryNames and CategoryID fields
the other table named Products has
ProductNames and CategoryID fields
Data1.RecordSource is set to Categories
Data2.RecordSource is not set
DBCombo1.Rowsource = Data1
DBCombo1.Listfield = CategoryNames
DBList1.Rowsource = Data2
DBList1.Listfield = ProductNames
====================================================
Programatically I want to set the Data2.RecordSource
when I choose an item in the BDcombo to populate the
DBlist
====================================================
Now if the DBCombo1.Listfield = CategoryID the code
is simple as follows:
Private Sub DBCombo1_Change()
Data2.RecordSource = "SELECT DISTINCTROW _
Products.ProductName FROM Products WHERE _
(Products.CategoryID = " & DBCombo1.Text & ");"
Data2.Refresh
End Sub
====================================================
But what is the code since
DBCombo1.Listfield = CategoryNames ?
there are two tables in the database
one table named categories has
CategoryNames and CategoryID fields
the other table named Products has
ProductNames and CategoryID fields
Data1.RecordSource is set to Categories
Data2.RecordSource is not set
DBCombo1.Rowsource = Data1
DBCombo1.Listfield = CategoryNames
DBList1.Rowsource = Data2
DBList1.Listfield = ProductNames
====================================================
Programatically I want to set the Data2.RecordSource
when I choose an item in the BDcombo to populate the
DBlist
====================================================
Now if the DBCombo1.Listfield = CategoryID the code
is simple as follows:
Private Sub DBCombo1_Change()
Data2.RecordSource = "SELECT DISTINCTROW _
Products.ProductName FROM Products WHERE _
(Products.CategoryID = " & DBCombo1.Text & ");"
Data2.Refresh
End Sub
====================================================
But what is the code since
DBCombo1.Listfield = CategoryNames ?