enable and disable labels?

kate10123

Registered User.
Local time
Today, 14:01
Joined
Jul 31, 2008
Messages
185
Hi there,

I have 6 buttons which are label controls. Ideally I want to set a condition that unless the label called 'New' is clicked, the label called 'Find Student' is greyed out and not clickable.

Any ideas how to do this with labels as opposed to buttons?
 
As you cannot disable a label as such why not change the forecolour of the label to look like a disabled control. and on the OnClick of the label tell it to exit if it's the wrong colour.

David
 
As David said make your label 'Find Student' with a grey font.

Then make whatever code or macro is behind the label only work if a condition is present, could be an X in a text box. Then change your code behind the label 'New' so that it changes the colour of the font in Find Student and iserts an X in a textbox so that the code behind Find Student will work.

If you use an X being inserted into an unbound text box then have some code or a macro that removes the X and have it for OnCurrent and also to change the font color for Find Student.
 
unless the label called 'New' is clicked, the label called 'Find Student' is greyed out and not clickable.

You may be confusing a command button with a label, since labels are not clicked to trigger an event. Labels can be greyed out if the enabled property of the associated textbox is set to false. A command button, including its caption, can be greyed out by changing its enabled property to false.

However, if you need to keep the command button active and you want to grey out the caption, do as David and Mike have suggested.
 
Last edited:
You may be confusing a command button with a label, since labels are not clicked to trigger an event. Labels can be greyed out if the enabled property of the associated textbox is set to false. A command button, including its caption, can be greyed out by changing its enabled property to false.

However, if you need to keep the command button active and you want to grey out the caption, do as David and Mike have suggested.

Stand Alone labels have several events and you are correct about the enable property being changed on the textbox changing an attached label.

I can't remember for sure but I think Access 95 had a couple of events for attached labels.

As a side note where labels are good instead of buttons is you can have a lot of them. Buttons can really crowd up the screen. I use a colour code sysem for labels. If the font is blue or green then clicking on it will make something happen. Labels can also be smaller than a button for the same size font plus you can change their background colour. You can also make them act like a button by setting the property to sunken or raised with macro or code behind the label.
 
If anyone is interested

Forms!MasterForm!Label1550.SpecialEffect = 1 does raised and a 2 does sunken. I forget the others.

In a macro it is SetValue action and

Item is [forms]![formname]![labelname].[specialeffect]
Expression is 1 or 2 etc
 
mike, you are better using vbconstants rather than specific values

eg I bet there is a

Forms!MasterForm!Label1550.SpecialEffect = vbraised
Forms!MasterForm!Label1550.SpecialEffect = vbetched
Forms!MasterForm!Label1550.SpecialEffect = vbsunken

etc - and you dont have to worry about what value they really are.
Far easier, and far more readable
 
Thanks for that gemma

Cetainly better than meaningless numbers as evidenced by the fact I could not remember the other numbers.

And as you say "vbetched" has meaning.
 
Stand Alone labels have several events and you are correct about the enable property being changed on the textbox changing an attached label.

I can't remember for sure but I think Access 95 had a couple of events for attached labels.

In Access2000 an attached label has no events. An unattached (stand alone) label has five trigger events. Click, DblClick, MouseUp, MouseMove, MouseDown. I didn't realize that stand alone labels had events associated with them.
 

Users who are viewing this thread

Back
Top Bottom