7/20/2012

Set the background color of a button in Access

Also learn how to set the background color of a button in Access 2007 | Access 2003/XP/2000/97.
Question: In Access 2003/XP/2000/97, how do I set the background color of a command button?
Answer: Unfortunately, you can't change the back color of a command button. As an alternative, you could create a label and have it behave as a button.

To do this, create a label. Right-click on the label and view its properties.
Set the Back Color property of the label to the color that you want. Then set the Special Effect property to Raised.
Then code it's Mouse Down event to:
[LabelName].SpecialEffect = 2
Code the Mouse Up event:
[LabelName].SpecialEffect = 1
Code the OnClick event as if it was a command button.
Center the label text horizontally using the text alignment tool button or setting the Text Align property to Center.
If you want to align text vertically, Press Shift + Enter then type in the label text.
It will look and act like a command button.

No comments:

Post a Comment