How to populate one dblist based on another dbList value 
Author Message
 How to populate one dblist based on another dbList value

I have are three dbLists each bound to a data control.  What I am trying to
do is to populate the second list based on the value selected in the first
list and to populate the third list based on the value selected on the
second list.

I am having a great deal of difficulty going past the second list box.  I
can not get the third one to populate at all.  Although my code can populate
lists 1 & 2, I get an error message indicating the Object doesnt support
the property or method  Here is the code that I am using:

Option Explicit
Dim sdB As Database
Dim lakeItem, elevItem, dbString, rsName As String

Private Sub datElev_Reposition()

lakeItem = dbLstLake.BoundText
elevItem = dbLstElev.BoundText

dbString = App.Path + "\Site Selection.MDB"     'define database path
Set sdB = OpenDatabase(dbString) ''define species code list database

rsName = "SELECT * FROM [Type] WHERE Lake= '" & lakeItem & "' AND Elev= '" &
elevItem & "'"
datType.DatabaseName = dbString
datType.RecordSource = rsName
'datType.Refresh

End Sub

Private Sub datLakes_Reposition()

lakeItem = dbLstLake.BoundText

dbString = App.Path + "\Site Selection.MDB"     'define database path
Set sdB = OpenDatabase(dbString) ''define species code list database
rsName = "SELECT * From Elevation where Lake= '" & lakeItem & "'"
datElev.DatabaseName = dbString
datElev.RecordSource = rsName
'datElev.Refresh

End Sub

Private Sub Form_Load()

datLakes.DatabaseName = App.Path + "\Site Selection.MDB"
datLakes.RecordSource = "SELECT * From Lakes"
datLakes.Refresh
lakeItem = datLakes.Recordset.Fields(0).Value

datElev.DatabaseName = App.Path + "\Site Selection.MDB"
datElev.RecordSource = "SELECT * From Elevation where Lake= '" & lakeItem &
"'"
datElev.Refresh
elevItem = datElev.Recordset.Fields(1).Value

datType.DatabaseName = App.Path + "\Site Selection.MDB"
datType.RecordSource = "SELECT * FROM [Type] WHERE Lake= '" & lakeItem & "'
AND Elev= '" & elevItem & "'"

End Sub

Maurice I. Muoneke



Wed, 21 Feb 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Populate Listbox, DBlist or Datalist control with several columns in one row with ado

2. populating dblist with asci data

3. dbLIST populating

4. Need to use dbList in a one-many-many scenario

5. PROBLEM HELP - Data control on one form and dblist on the other

6. DBList box Question (easy one :)

7. DBList box Question (easy one :)

8. PROBLEM HELP - Data control on one form and dblist on the other

9. DBList with more than one item

10. DBList with more than one item per column

11. DBList with more than one item

12. DBList with more than one item

 

 
Powered by phpBB® Forum Software