How do you disable a label

  • Thread starter Thread starter Peter Hibbs
  • Start date Start date
P

Peter Hibbs

Hi All

When you place a Text box control on a form and then disable it the
attached label is also 'greyed out'.

Is there any way to do the same with a Label control.

Peter Hibbs.
 
If the label is associated with a control that will accept input (a text
box, a combo box, a list box, etc.), it'll automatically be disabled when
you disable the control.

Since labels themselves cannot accept input, it doesn't really make sense to
be able to disable a non-associated label.
 
I think only by changing the fore colour in vba

Me.Trial_Label.ForeColor = 12632256 'Will be Grey
Me.Trial_Label.ForeColor = 8421504 'Will be Dark Grey
Me.Trial_Label.ForeColor = 0 'Will be Black

The VBA would have to be loaded in a control which if clicked or has focus
will change the fore colour of the label if I have understood your question
correctly????
--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all,
you have shouted at and blamed the innocent,
and asked everyone you know,

READ THE INSTRUCTION MANUAL.
 
Thanks Douglas and Mike.

The reason I want to do this is that I have a bunch of controls on a
form that are enabled or disabled, depending on what the user does,
and I have a label which I also wanted to 'appear' enabled/disabled.

I have done it by having the label attached to a Text box (which I
have made 1 pixel wide and so it does not show on the form). I can
then just enable or disable this text box to control the appearance of
its attached label.

I tried changing the colour of the label but it does not look quite
the same as a 'disabled' label.

Anyway, I have got the desired effect now.

Thanks

Peter Hibbs.
 
Peter Hibbs said:
I have done it by having the label attached to a Text box (which I
have made 1 pixel wide and so it does not show on the form). I can
then just enable or disable this text box to control the appearance of
its attached label.

You can make it 0 twips wide and tall, and Access will have no
complaint.
 
You can make it 0 twips wide and tall, and Access will have no
complaint.

You can replicate the disabled look with two (or maybe it's three)
labels with the same caption placed on top of each other, but offset
by a pixel or two in both directions. I forget the colors, but all
you'd do is make the shadow ones visible and change the color of the
top one.

Another approach might be an option group and put nothing inside it
and make the frame for it invisible.
 
David W. Fenton said:
Another approach might be an option group and put nothing inside it
and make the frame for it invisible.

I never thought of that one. Cute.
 
Back
Top