Disabling a Label control

Access: Disabling a Label control

Q: I need to disable a Label control, for a consistent appearance with some other controls on a form. But this control doesn’t have an Enabled property. Is there some way I can do this?

A: You can’t disable a Label control, but you can make it look disabled by setting its ForeColor property to match the color of a disabled textbox. On my computer the value of 10921638 works for this purpose. Then, when the control needs to look enabled, set the BackColor to vbBlack.

If you need to fiddle with color numbers to get a color match, use the zsfrmColors form in the sample database for Access Archon 189 (Working with Colors in Access 2007).

This form converts those new-style color values like #EFD3D2 or Accent 5, Lighter 80% (which can’t be used in VBA code) with Long values, which can be used in code.

Want More?

Office Watch has the latest news and tips about Microsoft Office.  Delivered once a week.