rjmccorkle
Programmer
I am trying to write code to duplicate a frame and it's controls at runtime. I can do it using the LOAD command and the individual control names. I would like to use a loop through the template frame's controls so I don't have to remember to add new code if I add a new control to the frame. To make it easier in the looping, I have every control in the template frame as an array with index 0 (so far about 50 controls; labels,textboxes,comboboxes,optionbuttons,frames). Here is the bit of code I am trying to use
vC=UBound(fraP)+1
For Each ctl In Controls
If Not ctl.Name Like "tim*" Then
If ctl.Container Is fraP(0) Then
Load ctl(vC)
End If
End If
Next ctl
1.Is there a way to address just the controls in the frame? Research so far shows I have to go through the form's controls then test the control's container (and I found out by experience that apparently Timer controls don't have Containers) and since I have frames inside the template frame, I will have to add the sub-frames' controls, perhaps using a subroutine called recursively.
2.The LOAD ctl(vC) generates a 344 Error. The ctl variable is referencing the indexed control like txtT(0), not the (my vocabulary is weak here) array txtT. How do I pass the Index for the new control?
Thanks for any help.
Bob
vC=UBound(fraP)+1
For Each ctl In Controls
If Not ctl.Name Like "tim*" Then
If ctl.Container Is fraP(0) Then
Load ctl(vC)
End If
End If
Next ctl
1.Is there a way to address just the controls in the frame? Research so far shows I have to go through the form's controls then test the control's container (and I found out by experience that apparently Timer controls don't have Containers) and since I have frames inside the template frame, I will have to add the sub-frames' controls, perhaps using a subroutine called recursively.
2.The LOAD ctl(vC) generates a 344 Error. The ctl variable is referencing the indexed control like txtT(0), not the (my vocabulary is weak here) array txtT. How do I pass the Index for the new control?
Thanks for any help.
Bob