Trying to locate a specific control on form

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

HI!!

Like my subject states, I need to know how to cycle through
all controls on form, identify which one are checkboxes
and if the tag of my checkbox="see" then render-it
visible..

Any Ideas.
This is what I've got so far!

Dim ctl as Control
For Each ctl In frm.Controls
If ctl = acCheckBox Then
' Im missing something here...
End If

Next ctl

Thanks in advance for any help you can give me!!
PAtrick
 
Patrick said:
Like my subject states, I need to know how to cycle through
all controls on form, identify which one are checkboxes
and if the tag of my checkbox="see" then render-it
visible..

Dim ctl as Control
For Each ctl In frm.Controls
If ctl = acCheckBox Then
' Im missing something here...
End If

Next ctl


If ctl.ControlType = acCheckBox Then
If ctl.Tag = "See" Then
ctl.Visible = True
End If
End If
 
Hi Marshall!!

Its not working at all!! Could you walk me through-it from
the begining.(including dim's and Set something to
something).
My controls by default are invisible. The tag property,
does it require that I write "see" or see for this to
work..

Thanks again!!!
PAtrick
 
Hi Marshall!!

Its not working at all!! Could you walk me through-it from
the begining.(including dim's and Set something to
something).
My controls by default are invisible. The tag property,
does it require that I write "see" or see for this to
work..

Thanks again!!!
PAtrick

This works for me:

Write
See
(no quotes needed) on the Tag property line.
Then code the Form's Open event (or whatever event you need):

Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is CheckBox Then
ctl.Visible = ctl.Tag = "See"
End If
Next
 
Patrick said:
Its not working at all!! Could you walk me through-it from
the begining.(including dim's and Set something to
something).

Not without seeing the remainder of your code, its context
and what control properties you are using. You never said
what the "frm" object is, or what else may be going on
around your code. You posted a small snippit of code and
asked for the missing part, and I replied with the fragment
you said you were missing along with a correction to your If
statement. With no additional information, I can't possibly
figure out what "not working at all" means, nor how to
trouble shoot whatever causes you to say that.

My controls by default are invisible. The tag property,
does it require that I write "see" or see for this to
work.

You would type
See
in the check box's Tag property.
 
Thanks for your help everything working perfectly now..
The code you gave me was correct, from what i can see, the
only thing that wasn't working is the "see". Change-it,
and works fine....

thanks again!!!
-----Original Message-----
Patrick said:
Its not working at all!! Could you walk me through-it from
the begining.(including dim's and Set something to
something).

Not without seeing the remainder of your code, its context
and what control properties you are using. You never said
what the "frm" object is, or what else may be going on
around your code. You posted a small snippit of code and
asked for the missing part, and I replied with the fragment
you said you were missing along with a correction to your If
statement. With no additional information, I can't possibly
figure out what "not working at all" means, nor how to
trouble shoot whatever causes you to say that.

My controls by default are invisible. The tag property,
does it require that I write "see" or see for this to
work.

You would type
See
in the check box's Tag property.
--
Marsh
MVP [MS Access]



.
 
Back
Top