Re: Conditional formatting changes field enabled property?



Thank you very much for your advice. Everyone is always so gracious with
advice on these forums. I will check into the Select statement for
programming this. As for setting the color, I was going to use your color
selection applet with the form's Dbl-click event instead of a button.

"Stephen Lebans" wrote:

Instead of If-Then-Else use the Select statement. It's cleaner and easier to
implement for this situation.

Your logic is correct for persisting the users color selection.. Add a
CommandButton or similiar to your form that allows the user to Select the
desired CF color. Save the color to a table. In the main Form's Load event,
set the FomatConditions object props for this control to the previously
saved color value.
It's better to set the FormatConditions object at runtime as there is a Bug
where CF does not respect the Enabled property when set via the CF GUI.

There is code in the CF sample on my Web site showing you how to do this.
Just post back if you are having any issues implementing your logic.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Anthony" <Anthony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ED345CB0-67EE-4778-94EB-A09741006BE3@xxxxxxxxxxxxxxxx
Thanks. Your right. I could write my own code and I believe I could do
it
even with my limited coding cred. I guess it will be 20 "IF-THEN-ELSE"
statements.
I know this thread has gone on for a long time, but if you can give me one
more piece of expertise I would appreciate it. If I do write my own CF
code
for 20 conditions, is there a way to let the user - at runtime - choose
what
formatting (color, font, etc) he wants the condition to set AND, most
importantly, it will HOLD that user-set formatting forever (until the
user
wants to change it) a la Excel even when that form or the database is
closed.
I take it that means somehow I will have to save the color in a table
because I don't think you can hard-code a runtime setting.
Thanks

"Stephen Lebans" wrote:

Anthony, go back and reread my previous post in this thread. You are not
limited to evaluating 3 criteria. You are limited to 3 fixed
FormatConditions. As I stated in my previous post, you can write your own
function, evaluating as many criteria as desired, and have the function
return True or Flase depending if you want CF to paint the control or
not.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Anthony" <Anthony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EDF71947-73A0-44B4-AD8A-99E4D8C8A73B@xxxxxxxxxxxxxxxx
Thanks. I think that is the situation I have. I have criteria that is
too
complex (varied) to be evaluated with the CF Expression. Said another
way,
the differences between records is so varied I would need 20
conditional
statements to handle all the different scenarios that can occur in that
field. The CF routine can only handle 3 criteria. Because of that
limitation, I thought it would be easier to just let the user set the
field
formatting (color) based on his evaluation of whether it is a exception
from
the norm rather than trying to hardcode 20 different exception
criteria.
I
was wanting to use your color selection applet to accomplish that but
it
sets
the same color for ALL records - it doesn't allow you to set different
colors
for different records. Your conditional formatting VB code almost
accomplished what I need, but it sets ALL fields in one record to the
chosen
color, I only need ONE field in the record to be changed. It looks
like
Access just doesn't have the capability to do what I want, otherwise
someone
with programming ability like you would have already done it.
"Stephen Lebans" wrote:

I think you are misunderstanding the use of Conditional Formatting. CF
is
applied, on a Control by Control basis, based on the criteria YOU set.
As
long as you can supply the proper criteria then CF can be applied to
that
single control, even in form set to Data*** or Continuous view.
If the calculation/determination of your criteria is too complex to be
evaluated directly within the CF Expression service then simply call a
user
defined function. If your function returns False then CF is not used
to
render the control. If your function returns True then whatever CF
Condition
you setup is applied to the control.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Anthony" <Anthony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2D2EFC1F-4B31-4F93-9AB0-773490BFA714@xxxxxxxxxxxxxxxx
OH! SOOOO Close. Stephen's Conditional formatting example ALMOST
does
what
I need but not quite. He is able to highlight a row and keep it
highlighted
after it has lost the focus just how I want but it highlights the
whole
record. I only need ONE field in the record highlighted. Also, it
appears
you must pre-set the color you want programmatically. I would like
to
set
the color during run-time using his pop-up color control applet.
Stephen
almost has achieved what I need. Maybe a little more tweaking of
the
code
and combining his color control applet and Viola! we may have it.
However, Doug, I think you may be right that Access does not quite
have
the ability to do what I would like.

"Douglas J. Steele" wrote:

Did you see the first description of what Stephen's example does?
("Highlighting of the Current Row for a Form in Continuous or
Data***
View")

Did you try it?


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Anthony" <Anthony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CB29AFC6-76CB-4727-B75F-FD068959BFF1@xxxxxxxxxxxxxxxx
Thanks Doug for your response. However, using conditional
formatting
would
change EVERY record that meets the condition. I may only want to
change
ONE
record. Oh, well. I guess I am thinking too far outside the
box.

"Douglas J. Steele" wrote:

The only way would be to use Conditional Formatting (which is
what
Stephen's
example below is all about)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Anthony" <Anthony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0F74288A-A7DF-49D0-9C69-F5D2D10277A0@xxxxxxxxxxxxxxxx
Stephen, you have code on your website for bringing up a
color
change
tool
that changes the background color of a control. I tried it
and
it
works
GREAT. However, it changes the color of the control for
EVERY
record.
Is
there a way in Access 2003 to change the color of the control
for
ONLY
the
record you have displayed (or in the case of continuous forms
or
spread***
view, the record that has the focus)? Also, since I am a
neophyte
VB
programmer I will need to be lead by the hand on the
programming
of
this
(if
it is possible to do)

"Stephen Lebans" wrote:

I pointed you to that solution so you could see how to
programmatically
setup the FormatConditions object. I never stated there was a
solution
specific to your requirements. If you take the time to
actually
open
the
code you will see what I am referring you to.

Good luck with your issue.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


"Access User" <AccessUser@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:287035CF-3053-4C64-891C-19699B33829C@xxxxxxxxxxxxxxxx
Thanks, but I don't think it's what I'm needing at the
moment
based
on
the
description

A2KConditionalFormatting.zip is a sample MDB demonstrating
how
to
programmatically setup Conditional Formatting to simulate:

1) Highlighting of the Current Row for a Form in Continuous
or
Data***
View

2) Highlighting of Alternate Rows for a Form in Continuous
or
Data***
View

Recall, that when I apply a conditional format to a text
control
on
my
sub-form so as to vary the color depending on the numerical
value
entered
(1-3 = green, gt 3 = red), that the enabled=no and
locked=yes
properties
get
trashed.

Thx.

"Stephen Lebans" wrote:

http://www.lebans.com/conditionalformatting.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


"Access User" <AccessUser@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in
message
news:B80F745A-C909-4B2D-BA18-85F1C4AFE57D@xxxxxxxxxxxxxxxx
That sounds like it could be really useful, but your
website's
a
little
overwhelming, can you please give me a few more details
wrt
.