473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Conditional Formatting Colors and Code

In a Continuous form, I want to use Conditional Formatting to change
the background color of a date field based on a condition.

1-The color chart in the CF menu option offers limited colors. How can
I use the custom colors I need ???

2-Is Conditional Formatting available in code, so that I can use more
than 3-conditions and have more versatility than the Access2k CF menu
option offers ???

Thanks Greg

Mar 3 '07 #1
4 14350
On 3 Mar 2007 13:59:40 -0800, "Ap******@gmail.com"
<Ap******@gmail.comwrote:

Re: 1: Too bad, so sad. But read Re: 2

Re: 2: Sure: you can create a single condition with "Expression Is",
and then as the expression you can specify your own function, which
would test all (more than 3) conditions you need. This must be a
public function in a standard module, returning a boolean.

AFAIK, there is no documented way to programmatically manipulate the
conditional formatting, but if you feel adventurous: open the object
browser (F2) right click Show hidden members then search for
"condi" (no, not Condi :-)) and you'll find interesting classes like
FormatCondition and FormatConditions to be explored.

-Tom.
>In a Continuous form, I want to use Conditional Formatting to change
the background color of a date field based on a condition.

1-The color chart in the CF menu option offers limited colors. How can
I use the custom colors I need ???

2-Is Conditional Formatting available in code, so that I can use more
than 3-conditions and have more versatility than the Access2k CF menu
option offers ???

Thanks Greg
Mar 3 '07 #2
Thankyou Tom

I experimented with the "Expression Is" option, and was able to
satisfy my condition issues.

However, I really need to be able to set the background color of a
field meeting the condition, to colors not showing on the grossly
limited color chart. There must be a way???

Thanks Greg

Mar 4 '07 #3
I believe I figured it out.

Me.txtMyTextBox.FormatConditions(0).BackColor = RGB(64, 128, 196)

I would use this expression in code in the LoadForm event to establish
my choice of color for the first Conditional Formatting result. And
follow this method for the others.

Greg

Mar 4 '07 #4
Ap******@gmail.com wrote:
>In a Continuous form, I want to use Conditional Formatting to change
the background color of a date field based on a condition.

1-The color chart in the CF menu option offers limited colors. How can
I use the custom colors I need ???

You can use colors other than what the palette offers by
using the FormatConditions "collection".

Private Sub Form_Open(Cancel As Integer)

Me.txtID.FormatConditions(0).BackColor = RGB(255,240,240)
Me.txtID.FormatConditions(1).BackColor = RGB(240,255,240)
Me.txtID.FormatConditions(2).BackColor = RGB(240,240,255)

End Sub

Regardless of what you do, a single control can only have
the default color plus three conditional colors. If you
need to go to extremes, you can play games by stacking text
boxes on top of each other and get another three colors for
each text box.

--
Marsh
Mar 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alex | last post by:
Is it possible to set conditional formatting using code in a module? Thanks for your help Alex
2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
4
by: brAccess | last post by:
I recently installed Access 2003 and immediately noticed problems with applications that work fine in 2000 and XP. I use conditional formatting on continuous forms for a number of reasons. When...
2
by: jeffgeorge | last post by:
Trying to add 3 colors to 6 combinations of text possibilities. If this makes sense, the possibilities are: A D (one color for the combo beginning with A) A E B D (One color for the combo...
0
by: GGerard | last post by:
Hello With MSAccess 2000, I have created a program with forms and applied some Conditional Formatting on some of the text box.
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
1
by: dddsssdddsss | last post by:
A comment and a question To anyone who is using conditional formatting, beware that in Access 2007 the color pallette is not the same as the color pallette in Access 2003. So if you have a...
10
by: Lyn | last post by:
Hi, I would like to make a bound text box not visible if it is empty (not just disable it). This option is not available from the standard conditional formatting feature (at least, not that I can...
1
by: DAObermeyer | last post by:
Hey all, first time here. I have a database that is designed to be opened and viewed at other locations on the network. I use Form (A) to modify Data in Table (A), and Form (B) is used scrictly...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.