Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can a field have multiple tags?

Status
Not open for further replies.

ImStuk

Technical User
Feb 20, 2003
62
US
I have a situation where I would like to assign a tag to many text boxes and labels, but I also have tags assigned to some of the same text boxes already for other things. Is there a way to separate the tags in the tag property to create multiple tags. I have tried "Tag1";"Tag2" and also just separating by comma's, but no luck. Thanks in advance.
 
Tags are free format fields--no structure to them. They are just one, long string of text. You must do your own slicing and dicing to separate the pieces you've entered. Typically, I use a colon :)) between things I want to separate in a Tag. Then, I use the Instr function to find the colons and split apart the pieces.
 
I was affraid of that. Thanks a lot for the quick response and help.
 
You can also do a little string manipulation so that you can still have subgroups. Tag everything in group 1 as "Group1" with a suffix for Group2 (Group1Attorney, Group1Client, Group1Attorney, Group1Hounddog, etc). Then when you loop through the controls, you can check for both groups on one tag:
dim ctl as control
for each ctl in me.controls
If left(ctl.tag, 6) = "Group1" then
'do what ever needs to be done to group 1
end if
If right(ctl.tag,(len(ctl.tag)-6)) = "Attorney" then
'do what needs to be done to the Attorneys subgroup
end if
next ctl

 
The Access Developer's Handbook by Litwin, Getz and Gilbert has a source code structure to handle multiple Tags in a control. If you have a copy of this book, check out Chapter 7. If not, I recommend getting a copy. It is the best reference by far for database development and coding.

HTH
Lightning

Access XX Developers Handbook
by Paul Litwin, Ken Getz and Mike Gilbert
Sybex Press
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top