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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Label

Status
Not open for further replies.

Dina01

Programmer
Mar 26, 2002
204
CA
Hey,

I was wondering if it would be possible to disable a Label from a form.

I have a form that has a few label that act like command buttons, I had to make them as label because of the appearance that I wanted. Therefore this is what I had coded for my labels.

Private Sub Form_Open(Cancel As Integer)
'Procedure that gives the command button special effect
'Set all the special effect for our buttons

Me.Btn_SupSec.SpecialEffect = 1

End Sub

Private Sub Btn_SupSec_Click()
' Time that agent advised the Supervisor
Me.HrsSupSecAvise = Time()
End Sub

Private Sub Btn_SupSec_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Give the effect of a command button
Me.Btn_SupSec.SpecialEffect = 2
End Sub

Private Sub Btn_SupSec_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Give the effect of a command button
Me.Btn_SupSec.SpecialEffect = 1
End Sub


This code works fine, but what I need to do is that when my textbox "HrsSupSecAvise " has a time in it I want to disable the button Btn_SupSec but I don't know how since it's really a lable...

This is what I had coded...

If Not IsNull(HrsSupSecAvise) Then
Me![HrsSupSecAvise].Enabled = True
Me.Btn_SupSec_Click = False
Else
'Nothing
End If
 
Does anyone know if this is possible
 
A label does not have an "Enabled" property. The only way I could think to cheat is to attach the lable to a text box, hide it, and disable IT instead of the label. This in turn will disable it's label (gosh, I'm suddenly reminded of the Libby's Libby's Libby's on the Label, Label Label commercial).

1) Add a new text box, and delete it's label.
2) Cut your "button" label
3) Select the newly added text box and paste (this will attach the label to the text box).
4) Make the width and heigth properties of the text box = 0.
5) Now programmtically disable the text box (which you can't see), and the label will disable as well.


Me.NewTextBox.Enabled = Not IsNull(Me.HrsSupSecAvise)


It certainly ain't pretty, but it should work. Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top