TAGS - Can I use them for...

Randomblink

The Irreverent Reverend
Local time
Today, 13:44
Joined
Jul 23, 2001
Messages
279
If I have a group of fields that I want to alter in VB in a report...
Could I group them, set their tags with something like "HAPPY" and another group to "SAD" and then if a certain record has a variable set to "HAPPY" make all the fields with the TAG:"HAPPY" turn visible and all the TAG:"SAD" turn invisible...?

Sad description but the best I could do to be descriptive...

So would that work...? And how do I reference TAGS in VB...? Anyone, Anyone, Bueller...
 
Try this code for a starting point:

Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.BackColor = ctl.Tag
End If
Next ctl
Set ctl = Nothing

You could obviously put other if statements in there if you wish,maybe

if ctl.tag<> "" and ctl.tag <> Null then

Select Case ctl.tag
Case = "Happy"
'happy action
Case = "Sad"
'sad action
Case = "Manic Depressive"
'you get the idea
Case Else
End Select

HTH

Ian
 

Users who are viewing this thread

Back
Top Bottom