arpeggione
Programmer
Hi: I originally had a set of procedures within a form working well for a custom collection of controls with tags. The controls all have the tag "Contract". When I move all of my procedures from the form to a module, I get the error 2467 (Application-defined or object-defined error). Any ideas? This may be some kind of declaration error. Note, I always use Option Explicit...
thank you in advance! Karen
procedures below:
The collection is:
Public mcolGroupContracts As New Collection
>I initialize the collection on form load by calling the procedure below:
Public Sub InitializeCollections()
Dim ctl As Control
If mcolGroupContracts.Count = 0 Then
For Each ctl In Me.Controls
If ctl.Tag = "Contract" Then
mcolGroupContracts.Add ctl, ctl.Name
End If
Next ctl
Set ctl = Nothing
End If
End Sub
>procedure is called from a secondary procedure in module
Call ShowControls(mcolGroupContracts, False)
>procedure itself (showing where it bombs)
Public Sub ShowControls(mcol As Collection, bolshow As Boolean)
MsgBox "Hello Show Controls"
Dim ctl As Control
MsgBox "SC1"
>procedure bombs out somewhere in here....
For Each ctl In mcol
MsgBox "ctl.name = " & ctl.Name
ctl.Visible = bolshow
Next ctl
MsgBox "SC2"
Set ctl = Nothing
End Sub
thank you in advance! Karen
procedures below:
The collection is:
Public mcolGroupContracts As New Collection
>I initialize the collection on form load by calling the procedure below:
Public Sub InitializeCollections()
Dim ctl As Control
If mcolGroupContracts.Count = 0 Then
For Each ctl In Me.Controls
If ctl.Tag = "Contract" Then
mcolGroupContracts.Add ctl, ctl.Name
End If
Next ctl
Set ctl = Nothing
End If
End Sub
>procedure is called from a secondary procedure in module
Call ShowControls(mcolGroupContracts, False)
>procedure itself (showing where it bombs)
Public Sub ShowControls(mcol As Collection, bolshow As Boolean)
MsgBox "Hello Show Controls"
Dim ctl As Control
MsgBox "SC1"
>procedure bombs out somewhere in here....
For Each ctl In mcol
MsgBox "ctl.name = " & ctl.Name
ctl.Visible = bolshow
Next ctl
MsgBox "SC2"
Set ctl = Nothing
End Sub