G
Grant Williams
Hi folks
I have a form with a combo. After the combo is updated,
the event goes off and retrieves a list of values that I
used to create several textboxes at runtime. The number
of textboxes created varies depending on the selection
made by the combo.
However, when I go to change the combo selection, I need
to remove all the textboxes I've created and regenerate a
new list of textboxes whether that be more or less than
the previous selection.
When I try and remove the textboxes tho, I get a "Runtime
Error: '444' Could not delete the controls. This method
cant be used in this context.
Any info is much appreciated. (below is the code)
'*********************************************************
Sub ClearTemporaryControls()
Dim i As Integer
Dim ctrl As Control
Dim objPage As Page
Const SEARCH_STRING = "txtSprocParam"
Set objPage = Me.multiPageKPIs.Pages.item(1)
For i = 0 To objPage.Controls.Count - 1
Set ctrl = objPage.Controls.item(i)
If Left(ctrl.Name, 13) = SEARCH_STRING Then
objPage.Controls.Remove ctrl.Name
End If
Next i
End Sub
'*********************************************************
I have a form with a combo. After the combo is updated,
the event goes off and retrieves a list of values that I
used to create several textboxes at runtime. The number
of textboxes created varies depending on the selection
made by the combo.
However, when I go to change the combo selection, I need
to remove all the textboxes I've created and regenerate a
new list of textboxes whether that be more or less than
the previous selection.
When I try and remove the textboxes tho, I get a "Runtime
Error: '444' Could not delete the controls. This method
cant be used in this context.
Any info is much appreciated. (below is the code)
'*********************************************************
Sub ClearTemporaryControls()
Dim i As Integer
Dim ctrl As Control
Dim objPage As Page
Const SEARCH_STRING = "txtSprocParam"
Set objPage = Me.multiPageKPIs.Pages.item(1)
For i = 0 To objPage.Controls.Count - 1
Set ctrl = objPage.Controls.item(i)
If Left(ctrl.Name, 13) = SEARCH_STRING Then
objPage.Controls.Remove ctrl.Name
End If
Next i
End Sub
'*********************************************************