Multiple Tags

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
 
B

BruceM via AccessMonster.com

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 want
to do, depending on the details. For instance, you could have the code look
at the first or last character in a tag, or its length, or the name of the
control, etc.
 
A

Al Campagna

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."
 
A

Al Campagna

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.
 
S

Steph

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
 
B

BruceM via AccessMonster.com

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]
 
B

BruceM via AccessMonster.com

Yes, it should go into the form's Current event if you wish to hide/unhide
etc. the controls when you first arrive at a record.
Thanks so much Al, does that also need to go in the forms "Oncurrent" ?
Steph,
A Tag is just a string. So it's possible to have multiple
[quoted text clipped - 24 lines]
 
A

Al Campagna

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top