M
mscertified
I'm displaying a tree-structure via a combo box. What I want to do is to
allow the user to make a selection from the combo box and then immediately
drop down a new selection list based on the previous selection. I have tried
to do this but so far have not found a way that works and now I'm wondering
if its possible at all. Here is the code I tried:
Private Sub cmbCategory_Click()
' Click causes new rowsource of rows (if any) having the current id as
parent
' i.e. drill-down
If Nz(Me!cmbCategory, vbNullString) = vbNullString Then
Me!CatPar = 0
Me!cmbCategory.Requery
Me!cmbCategory.Dropdown
Else
If Me!cmbCategory.Column(2) = "+" Then 'More levels below?
Me!CatPar = Me!cmbCategory.Column(0) 'Load hidden control with Id
Me!cmbCategory.Requery
Me!cmbCategory.Dropdown
Else
MsgBox "Reached Category bottom level", vbOKOnly, "CATS"
End If
End If
End Sub
Private Sub cmbCategory_DblClick(Cancel As Integer)
' Double click causes relisting of root levels
Me!CatPar = 0 'Hidden control referred to by query
Me!cmbCategory.Requery
Me!cmbCategory.Value = Null
Me!cmbCategory.Dropdown
End Sub
As you can see the combo box data contains the id of the current row which
when drilling down is the parent pointer of the lower level rows.
The click event does a drill-down and the double-click event returns control
to the top level.
Can anyone see what I am doing wrong?
Thanks.
allow the user to make a selection from the combo box and then immediately
drop down a new selection list based on the previous selection. I have tried
to do this but so far have not found a way that works and now I'm wondering
if its possible at all. Here is the code I tried:
Private Sub cmbCategory_Click()
' Click causes new rowsource of rows (if any) having the current id as
parent
' i.e. drill-down
If Nz(Me!cmbCategory, vbNullString) = vbNullString Then
Me!CatPar = 0
Me!cmbCategory.Requery
Me!cmbCategory.Dropdown
Else
If Me!cmbCategory.Column(2) = "+" Then 'More levels below?
Me!CatPar = Me!cmbCategory.Column(0) 'Load hidden control with Id
Me!cmbCategory.Requery
Me!cmbCategory.Dropdown
Else
MsgBox "Reached Category bottom level", vbOKOnly, "CATS"
End If
End If
End Sub
Private Sub cmbCategory_DblClick(Cancel As Integer)
' Double click causes relisting of root levels
Me!CatPar = 0 'Hidden control referred to by query
Me!cmbCategory.Requery
Me!cmbCategory.Value = Null
Me!cmbCategory.Dropdown
End Sub
As you can see the combo box data contains the id of the current row which
when drilling down is the parent pointer of the lower level rows.
The click event does a drill-down and the double-click event returns control
to the top level.
Can anyone see what I am doing wrong?
Thanks.