CONDITIONALLY CHANGE THE BACKGROUND COLOR OF A TEXT BOX ON A CONTINUOUS FORM

This MSAccess tutorial explains how to conditionally change the background color of a text box on a continuous form in Access 2007 (with screenshots and step-by-step instructions).

See solution in other versions:

Question: In Microsoft Access 2007, how can I change the background color of a text box containing a date value on a Continuous Form? I would like to set the color individually on each record.

For example, if I had a field called Expiration_Date, I would like to change the color of this field only on the records where the date is older than today. Can this be done?

Answer: This can be accomplished with Conditional Formatting.

To do this, open the form in design view. Right click on the text box that you wish to conditionally format. Select “Conditional Formatting” from the popup menu. In this example, we want to conditionally format the Expiration_Date.

Microsoft Access

A Conditional Formatting window should appear. Select “Field Value Is” from the Condition1 combo box. Select “less than” from the next combo box and enter the following formula in the third field:

Now()

Microsoft Access

Next, select the formatting that you’d like to apply when this condition is met. We’ve chosen to change the background color to red when the Expiration_Date is less than the current system date/time.

Click on the OK button.

Microsoft Access

Now, when you view your Continuous Form, the records whose Expiration_Date is older than the current system date/time will display a red background.

You can apply this technique to change the forecolor of the text field as well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s