R
Ray C
I have a routine that I use to set various parameters of certain controls on
my form and I manage which control by assigning each control a "Tag" name as
follows :-
Public Sub util_FormSetup(frm As Form, Opps As String, Stat As Boolean, all
As Integer)
Dim cntrl As Control
On Error GoTo Err_Util_FormSetup
For Each cntrl In frm
Debug.Print cntrl.Name; " "; cntrl; " "; cntrl.Tag
Select Case all
Case 0 ' Apply "Stat" to every Control on
the Form
cntrl.Properties(Opps) = Stat
Case 1 '
Apply "Stat" only to a Control
If cntrl.Tag = "Lock" Then cntrl.Properties(Opps) = Stat
'where Tag = "Lock"
Case 2 '
Apply "Stat" only to a Control
If cntrl.Tag = "Find" Then cntrl.Properties(Opps) = Stat
'where Tag = "Find"
End Select
Next cntrl
Exit_Util_FormSetup:
Exit Sub
With the appropriate parameters being passed to the routine. "Form" = the
Form Name, "Opps" = the operation Visible / Locked etc, "Stat" = True / False
and "all" is a numeric value that picks out which group of controls I want to
work on i.e 0 = All the Controls on the Form, 1 = only the controls with
"Tag" set to "Lock" etc
My logic being that the operation would only be actioned on a control where
the appropiate Tag was set. If a control had it's Tag set to nothing or set
to anything other than what was required then the operation should then skip
past it and not effect any change.
Howeve, wenever I use this routine to "Lock" or "Unlock" a control for
editing, the routine seems to run through a few controls OK and the produces
an Error Number 438 "object does not support this property or method". I have
a sneaky feeling that this could be something to do with the labels that are
on the form but if their Tag is Blank the routine should just ignore the
label and move on to the next control.
This routine used to work fine until recently and whilst I appreciate that I
must have done something to affect the change, I do not know what that might
be and therefore I can not put it right.
Any help appreciated Thanks ray C
my form and I manage which control by assigning each control a "Tag" name as
follows :-
Public Sub util_FormSetup(frm As Form, Opps As String, Stat As Boolean, all
As Integer)
Dim cntrl As Control
On Error GoTo Err_Util_FormSetup
For Each cntrl In frm
Debug.Print cntrl.Name; " "; cntrl; " "; cntrl.Tag
Select Case all
Case 0 ' Apply "Stat" to every Control on
the Form
cntrl.Properties(Opps) = Stat
Case 1 '
Apply "Stat" only to a Control
If cntrl.Tag = "Lock" Then cntrl.Properties(Opps) = Stat
'where Tag = "Lock"
Case 2 '
Apply "Stat" only to a Control
If cntrl.Tag = "Find" Then cntrl.Properties(Opps) = Stat
'where Tag = "Find"
End Select
Next cntrl
Exit_Util_FormSetup:
Exit Sub
With the appropriate parameters being passed to the routine. "Form" = the
Form Name, "Opps" = the operation Visible / Locked etc, "Stat" = True / False
and "all" is a numeric value that picks out which group of controls I want to
work on i.e 0 = All the Controls on the Form, 1 = only the controls with
"Tag" set to "Lock" etc
My logic being that the operation would only be actioned on a control where
the appropiate Tag was set. If a control had it's Tag set to nothing or set
to anything other than what was required then the operation should then skip
past it and not effect any change.
Howeve, wenever I use this routine to "Lock" or "Unlock" a control for
editing, the routine seems to run through a few controls OK and the produces
an Error Number 438 "object does not support this property or method". I have
a sneaky feeling that this could be something to do with the labels that are
on the form but if their Tag is Blank the routine should just ignore the
label and move on to the next control.
This routine used to work fine until recently and whilst I appreciate that I
must have done something to affect the change, I do not know what that might
be and therefore I can not put it right.
Any help appreciated Thanks ray C