Multiple Tags

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

Hello all. is it possible to have mulitple tags on controls? I am attempting
to hide/show certain controls based upon a selection, and i figured out I
need more than one option.

Thanks!
Steph
 
Steph,
A Tag is just a string. So it's possible to have multiple
string values in it, that can be found and recognized by code.
Given a Tag of...
Test1 Test2

Private Sub cmdTest_Click()
Dim Ctl As Control
For Each Ctl In Me.Controls
If InStr(Ctl.Tag, "Test2") Then
Ctl.Visible = False
Else
Ctl.Visible = True
End If
Next Ctl
End Sub

This code hides any control on the form that has "Test2" in the Tag
string.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
BruceM,
The Tag for a control is just a string, so using string functions, it's
possible to find "uniques strings" within the Tag.
Please see my example to the OP.
 
Thanks Bruce! i could do it control by control I guess too. I just loved the
tag option, and wanted to exploit it as much as possible!

thanks again
 
Apologies if I misunderstood...
Al

BruceM via AccessMonster.com said:
While I did not specifically mention that the Tag is a string, I thought I
had made the point that the code can look at a portion of the Tag or
another
of its attributes such as length.

Al said:
BruceM,
The Tag for a control is just a string, so using string functions,
it's
possible to find "uniques strings" within the Tag.
Please see my example to the OP.
AFAIK a control can have just one Tag, although you can change a Tag
programatically. However, there may be other ways to achieve what you
[quoted text clipped - 11 lines]
Thanks!
Steph
 
Back
Top