Conditional Formatting NOT WORKING

C

CSAngel

I am using Access 2007 and I am having a terrible time trying to get things
to work.

I have to combo boxes and a text box. I want the text box to change colour
based on the result of multiplying the combo box values like so:

combo 1 x combo 2 =
0 to 5: green
6 to 15 : yellow
16 to 25: red

What I did was create an OnChange event for the combo boxes that multiplies
their values and puts the result in the text box - that works awesome.
Then I set up conditional formatting for the text box using Value Is and
between x and y but it doesn't work. At first the colours were random
(didn't match the conditions ie: a value of 10 gave me a green box). Now I
don't get any colours. I have the enabled property set to true.

Has anyone else had issues like this?

I also tried using an expression to multiply the combo box values together
but that didn't work either.

Does the conditional format box generate VB code somewhere that I can debug?

Thanks!

Angel
 
N

Neil

CSAngel said:
I am using Access 2007 and I am having a terrible time trying to get things
to work.

I have to combo boxes and a text box. I want the text box to change
colour
based on the result of multiplying the combo box values like so:

combo 1 x combo 2 =
0 to 5: green
6 to 15 : yellow
16 to 25: red

What I did was create an OnChange event for the combo boxes that
multiplies
their values and puts the result in the text box - that works awesome.
Then I set up conditional formatting for the text box using Value Is and
between x and y but it doesn't work. At first the colours were random
(didn't match the conditions ie: a value of 10 gave me a green box). Now
I
don't get any colours. I have the enabled property set to true.

First, not sure why you're using the OnChange event of the combo boxes. You
should be using the AfterUpdate event.

But, getting back to conditional formatting, it's a pretty limited feature.
I believe the control has to be bound to the value. Not sure, but I believe
that's the case.

Are you using bound fields for the combo boxes? If so, then create a
calculated field equal to the product of the two combo box fields in the
underlying query itself, and then bind the text box to that new calculated
field. That should get your conditional formatting to work.

Neil
 
A

a a r o n . k e m p f

I thought that you had to do this calc on the query, not on the form

then you display the value.. and when it's 10 you make it green-- or
whatever conditions you want.

I'm pretty sure I just had to move this to the query (instead of an
expression on the form) but that was in Access 2003

hth

-Aaron
MCITP: SQL 2005 DBA
 
C

CSAngel

Thanks for the help - I actually coded the colour change in VB instead and it
works great.

But to answer your question - I didn't bind the text box to anything. I put
the calculated value in the text box.

Follow up question - why do I want to use AfterUpdate instead of OnChange?
 
L

Larry Linson

CSAngel said:
Follow up question - why do I want to use AfterUpdate instead of OnChange?

Because OnChange fires with every keystroke, and that's probably not what
you want.

Larry Linson
Microsoft Office Access MVP
 
N

Neil

But to answer your question - I didn't bind the text box to anything. I
put
the calculated value in the text box.

Yes, I know you didn't bind the text box to anything. You were calculating
the value. I understood that. I was asking if your COMBO BOXES were bound to
data; and, if so, then you should create a calculated value in the query and
bind the text box to that.

But you got it resolved, so it doesn't matter.

Neil
 

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