Private Sub chkA_C_Click()
If Me.lblAc.Caption = "Air Conditioning" Then
Me.lblAc.Caption = "Central Air Conditioning"
Else
Me.lblAc.Caption = "Air Conditioning"
End If
Me.lblAc.Width = (Len(Me.lblAc.Caption) * 72) * 1.1
End Sub
[code]
The "Caption" property of the label is actually the "Text" of the label. The Width property is the width (here it is in PIXELS). The "Constant" value (72 here) is the pixels per character for the font / size (here it is Tahoma 8pt). The "constant" (Here 1.1) just provides a 'comfort zone' space, so that it is aparent that the Caption is not truncated.
Again, this contrived example DOES NOT have the various V&V /error checking. At a minium, you need to check the control (in it's entireity) remains within the container (Form/subform/tabPage ... ). It would ALSO be "nice" to see that it did NOT intrude into another controls "space".
MichaelRed
mred@att.net
There is never time to do it right but there is always time to do it over