473,404 Members | 2,114 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,404 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 14361
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.