Hi,
Ive been trying to get a piece of code out that dynamicaly looks at several controls at a certain "level" and sets the controls on the "levels" below to a value that the user has chosen on the first level... I'll try to explain:
The user has 8 levels of data, the first level choise determines the data on all the other levels. Its a tree structure.
I have a combo box and 2 text boxes ( can be labels if that makes adifference) for each level. The combo box gets data for the user to pick and the text boxes display additional info.The structure goes like this:
Combo1 : Description1 ; ResponsiblePerson1
Combo2 : Description2 ; ResponsiblePerson2
Combo3 : Description3 ; ResponsiblePerson3
Combo4 : Description4 ; ResponsiblePerson4
The simplified code im using is this:
My question is, is there any elegant way to also find/set the text/label boxes to say combo1.column(2)??
I seem to have to do it in that if statement, but if i do that will I have to loop through all the controls again? Can I look/find all 3 controls at the same time? Or at least set them as variables for the levels loop?
Ive been trying to get a piece of code out that dynamicaly looks at several controls at a certain "level" and sets the controls on the "levels" below to a value that the user has chosen on the first level... I'll try to explain:
The user has 8 levels of data, the first level choise determines the data on all the other levels. Its a tree structure.
I have a combo box and 2 text boxes ( can be labels if that makes adifference) for each level. The combo box gets data for the user to pick and the text boxes display additional info.The structure goes like this:
Combo1 : Description1 ; ResponsiblePerson1
Combo2 : Description2 ; ResponsiblePerson2
Combo3 : Description3 ; ResponsiblePerson3
Combo4 : Description4 ; ResponsiblePerson4
The simplified code im using is this:
Code:
Private Function UpdateNextLevel(CL As Integer)
Dim ComboCtrl As Control
Dim DescCtrl As Control
Dim RespPCtrl As Control
Dim SQL As String
For NL = CL To 8
For Each ComboCtrl In Me.Controls
If ComboCtrl.Name = "Combo" & NL Then
'build SQL for next combo <cut out>
'seting up the next level rowsource
ComboCtrl.RowSource = SQL
nl = nl +1
end if
next
next
My question is, is there any elegant way to also find/set the text/label boxes to say combo1.column(2)??
I seem to have to do it in that if statement, but if i do that will I have to loop through all the controls again? Can I look/find all 3 controls at the same time? Or at least set them as variables for the levels loop?