Posted on 2013-10-25
I have a number of labels on a form and they all have their visible property set to no.
I have given all labels Tag properties depending on which I want visible. So if the user selects "A" from cboRack then all labels with Tag property of "A" will show and all others will not. I am trying to show labels based only on a selection in cboRack.
I have this so far but keep getting an error.
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag = cboRack Then
ctrl.Visible = True
ctrl.Visible = False
If I take out the else statement it works, but when the user changes the selection in cboRack, the original set of tags are still visible as well as the new selection. I'm trying to hide all labels with tags that are not = to the cboRack selection.
"Can't hide a control that has the focus"
Any help is greatly appreciated