Conditional formatting

H

Herb Wexler

I am having trouble getting conditional formatting to do what I want. I
select the control and then click on the Conditional button on the ribbon and
enter the expression. Is there a way to see the generated code?

Basically I want the color of one control to change based on the value of
another control.

Is there a way to use VB code to accomplish bypassing the Conditional
button?
 
D

Daniel Pineault

To my knowledge there is no way to see what Access has done to create your
conditional formatting. That said, I have used CF in numerous case just like
yours and it works quite nicely.

But to answer your secondary question, Yes, you can use vba to create your
own custom conditional formatting routine. What I'd suggest is that you
create a sub or function, depending on your needs, that does all your
formatting logic... then call it as req'd. In this case,you'll need to call
it in the 'current' event of the form so when you move to another record the
formatting is right and also in the afterupdate event of each control that
impacts your conditional formatting.

FYI, you can change the color of a color, or even a form section, by using
the .BackColor = RGB(0, 0, 255)... Simply change the RGB values to get the
desired color.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
H

Herb Wexler

I'm experimenting with Access 2007. I create two forms for the same table.
One form shows one record on the form the other is a split form. Based on the
value of a Yes/No check box I want another field to turn red. It works fine
on the regular form but does not work on the split form.

Is this a limitation of the Conditional Formatting button?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top