totn Access

MS Access 2007: Set the background color of a button

This MSAccess tutorial explains how to set the background color of a button in Access 2007 (with screenshots and step-by-step instructions).

Question: In Microsoft Access 2007, 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. In this case, we've set the Back Color to #FFC0E. Then set the Special Effect property to Raised.

Microsoft Access

You will need to place code on the label's "On Mouse Down" and "On Mouse Up" events.

Microsoft Access

In this example, we have placed the following code on the Mouse Down event:

Label1.SpecialEffect = 2

And the following code on the Mouse Up event:

Label1.SpecialEffect = 1

This make the label simulate the behavior of a command button.

Microsoft Access

You will need to place code on the OnClick event as if it was a command button.

Microsoft Access

Next, 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.

Microsoft Access

Your label will now look and behave like a command button.

Microsoft Access