ray: Oh Board Masters…I need help! I have 6 list boxes on a form. I need to have the first one filtered as such… Me.Super.RowSource = ("Select DISTINCT [SUPV] from Employees") Then, I need to filter each subsequent box based on the selected item in the previous box. Can someone help?
Here is the code that I am working on:
Private Sub Form_Load()
Me.Super.RowSource = ("Select DISTINCT [SUPV] from Employees")
End Sub
Private Sub Super_AfterUpdate()
'Select a supervisor from 1st supervisor list to use as filter
'for 2nd list/combo box
Me.Super1.RowSource = "select [name] from employees where [empno] = Me.Super.ItemData(0))"
Me.Super1 = Me.Super1.ItemData(0)
'Select a supervisor from 2nd supervisor list to use as filter
'for 3rd list/combo box
Me.Super2.RowSource = "select [name] from employees where [empno] = Me.Super1.ItemData(0))"
Me.Super2 = Me.Super2.ItemData(0)
'Select a supervisor from 3rd supervisor list to use as filter
'for 4th list/combo box
Me.Super3.RowSource = "select [name] from employees where [empno] = Me.Super2.ItemData(0))"
Me.Super3 = Me.Super3.ItemData(0)
'Select a supervisor from 4th supervisor list to use as filter
'for 5th list/combo box
Me.Super4.RowSource = "select [name] from employees where [empno] = Me.Super3.ItemData(0))"
Me.Super4 = Me.Super4.ItemData(0)
'Select a supervisor from 5th supervisor list to use as filter
'for 6th list/combo box
Me.Super5.RowSource = "select [name] from employees where [empno] = Me.Super4.ItemData(0))"
Me.Super5 = Me.Super5.ItemData(0)
End Sub
Here is the code that I am working on:
Private Sub Form_Load()
Me.Super.RowSource = ("Select DISTINCT [SUPV] from Employees")
End Sub
Private Sub Super_AfterUpdate()
'Select a supervisor from 1st supervisor list to use as filter
'for 2nd list/combo box
Me.Super1.RowSource = "select [name] from employees where [empno] = Me.Super.ItemData(0))"
Me.Super1 = Me.Super1.ItemData(0)
'Select a supervisor from 2nd supervisor list to use as filter
'for 3rd list/combo box
Me.Super2.RowSource = "select [name] from employees where [empno] = Me.Super1.ItemData(0))"
Me.Super2 = Me.Super2.ItemData(0)
'Select a supervisor from 3rd supervisor list to use as filter
'for 4th list/combo box
Me.Super3.RowSource = "select [name] from employees where [empno] = Me.Super2.ItemData(0))"
Me.Super3 = Me.Super3.ItemData(0)
'Select a supervisor from 4th supervisor list to use as filter
'for 5th list/combo box
Me.Super4.RowSource = "select [name] from employees where [empno] = Me.Super3.ItemData(0))"
Me.Super4 = Me.Super4.ItemData(0)
'Select a supervisor from 5th supervisor list to use as filter
'for 6th list/combo box
Me.Super5.RowSource = "select [name] from employees where [empno] = Me.Super4.ItemData(0))"
Me.Super5 = Me.Super5.ItemData(0)
End Sub