Conditional formatting - non-std background colors?

I am using conditional formatting in a datasheet.  I want one of the conditions to produce a backcolor that is not among the std colors in MSAccess.

Is it possible to implement Conditional Formatting in code and select custom color codes?

Any sample code to sahre?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

After selecting the color in design view of your form, click "Define Custom Color". This offers you a complete pallette of the spectrum and you can create ANY color you want. I don't believe you can import a custom color.
markp99Author Commented:

I can see "define custom color" while in design view.  I have created the shade I desire and added it to the custom color section of the color pallet.

However, when I select Conditional Formatting for a field on a form, I still only see the standard set of 40 colors.  My "custom color" is not visible in the pallet.

Am I doing something wrong, or maybe I misunderstood your reply?


markp99Author Commented:
Found a solution:

1. Open the form in design view.

2. Select the field in question, choose Conditional Formatting (CF) from the
Format menu. Set the condition you want, and click any std color in the
pallet - say, red. Close the CF dialog.

3. Press Ctrl+G to open the Immediate Window.

4. Type this into the Immediate window:    
    ? Forms![FormName]![FieldName].FormatConditions(0).BackColor
Displays the current backcolor setting for condition 0 (first condition)
Red = 255

5. Now that you know the expression is working, you can assign the color you
want by entering:
    Forms![FormName]![FieldName].FormatConditions(0).BackColor = 65000

6. Save the form. In future, the CF on this text box will use the NEW
background color.

7. Repeat for other attributes and conidtions.

This question may be closed.


You are right, there is no other way. In addition to the above, you can use, as for all color properties:

    .....BackColor = RGB(192,192,192)   ' three color components
    .....BackColor = &HFFFF00&            ' color as hex value
    .....BackColor = vbActiveTitleBar       ' system color constants (desktop theme)
    .....ForeColor = vbTitleBarText         ' logically ;)

This being said, it's of course a case for {http:/help.jsp#hi70} -- thanks for the detailed answer!

PAQed with points refunded (250)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.