Why does conditional formatting Enable a disabled field?

daybw

New member
Local time
Today, 12:53
Joined
May 12, 2009
Messages
1
I have fields in a form which are disabled. i want to see them but no navigation. I put in some color coding based on value with the conditional formatting dialog, but I found it "re-enables" the field. I can navigate and type in values. How can i keep the field as view only and keep the conditional formatting. (I use the "Enabled" property to disable the field)
Access 2003.
 
Well, I know it's been 9 months, but since I spent an hour searching for ways to overcome this issue (this being the only reference I found), I thought I'd sign up to post the workaround I came up with.

First, a little more detail to the problem:

Conditional formatting appears to override all settings, including the enabled/disabled property.
There is apparently no way to set it to inherit any of the properties, like, in this instance, keeping it from updating the disabled property if you are changing it in code.
In my project, I needed the conditional formatting for a continuous form textbox, but enabled and disabled the textbox via code while the program was running.
When the textbox was disabled, it left the conditionally formatted textbox enabled and with a white background, while the rest of the same textbox were disabled.

Here's my somewhat inelegant solution:

Place an invisible textbox on your form, say "txtDisabled".
In your code, when you disable the textbox, set txtDisabled to 1. When you enable, set it to 0.

Go into your conditional formatting and set the first condition to "Expression" and fill the expression as "[txtDisabled]=1" (without the quotes, but the brackets are important).
Set the conditions for that one to be disabled.

Then make the 2nd condition the typical condition -- in my case, if the box says "sold out", it makes it bold and red.

Now the conditional formatting will disable itself when the textbox is disabled.
I had hoped to use an expression more like "me.textbox.enabled=false", but could not get any variants of that to work. Maybe someone else can.
 
Did you make sure to use this button when setting the conditional formatting?

attachment.php
 

Attachments

  • cfen.png
    cfen.png
    24.2 KB · Views: 6,114
That's the button I used for first expression condition.

If I used it on the condition of "sold out", then all the boxes with sold out would be disabled (or enabled), whether the property for the box was or not.

I'm not sure if I was clear, but part of the issue was the continuous form. Here's what I mean:
 

Attachments

  • example.PNG
    example.PNG
    5.4 KB · Views: 464
Did you put your code in the Load event of the report or the Format event of the Detail section?

Oops, I should have also said, you should try using code :)
 
You know, I feel like that may have crossed my mind at one point, and was immediately dismissed, because I just remembered using it for reports.

Now why my many searches didn't pick that up, I don't know. :)

Thanks.

We'll go with "use my solution if you have an extreme aversion to using vba". heh.
 
And I see now that you were talking about reports. Oh well. This is for a continuous form.
 
Did you make sure to use this button when setting the conditional formatting?

attachment.php

rarely use condiitonal formatting, and never knew that was there at all - may be very useful.
 

Users who are viewing this thread

Back
Top Bottom