How to color boxes in continuous subform?

W

WDSnews

I have a child table with an ID field and two number fields. The number
fields are named CountLo and CountHi and contain numbers between 0 and 12.
I want to color some boxes on a subform based on the numbers in Lo and Hi.

I've built a parent form and subform in which the subform records display as
continuous forms. I chose 'continuous forms' because I want to see several
child records at one time. The subform has 13 boxes named box0 ... to ...
box12. I want all the boxes to be white except for the boxes representing
the range from Lo to Hi. For example, if countLo is 3 and countHi is 8, I
want box3, box4, box5, box6, box7, and box8 to be yellow.

It would be easy if I could change the colors each time I change a value,
but how do I simply display the correct colors for data that was previously
entered? I've tried the Open event and a few others, but these events don't
seem to trigger with each occurance of continuous child records. They fire
once when the parent form loads, but they aren't triggered after that.

thanks for your help.
 
K

ken

Use conditional formatting on the box3, box4, box5, box6, box7, and
box8 controls. The condition for each will be:

Expression is [countLo] = 3 And [countHi] = 8

By clicking the Add button in the conditional formatting dialogue you
can set the controls' BackColor to be different colours for different
combinations of values in the other two controls.

Ken Sheridan
Stafford, England
 
W

WDSnews

The conditional formatting is almost working for me. Since the child field
uses a "K" to represent 0, I need something similar to the following, but
the following doesn't work.

expression is:
[cboHi]>=1 And ([cboLo]<1 Or [cboLo]="K")

How can I handle this situation?


Use conditional formatting on the box3, box4, box5, box6, box7, and
box8 controls. The condition for each will be:

Expression is [countLo] = 3 And [countHi] = 8

By clicking the Add button in the conditional formatting dialogue you
can set the controls' BackColor to be different colours for different
combinations of values in the other two controls.

Ken Sheridan
Stafford, England

I have a child table with an ID field and two number fields. The number
fields are named CountLo and CountHi and contain numbers between 0 and
12.
I want to color some boxes on a subform based on the numbers in Lo and
Hi.

I've built a parent form and subform in which the subform records display
as
continuous forms. I chose 'continuous forms' because I want to see
several
child records at one time. The subform has 13 boxes named box0 ... to ...
box12. I want all the boxes to be white except for the boxes
representing
the range from Lo to Hi. For example, if countLo is 3 and countHi is 8,
I
want box3, box4, box5, box6, box7, and box8 to be yellow.

It would be easy if I could change the colors each time I change a value,
but how do I simply display the correct colors for data that was
previously
entered? I've tried the Open event and a few others, but these events
don't
seem to trigger with each occurance of continuous child records. They
fire
once when the parent form loads, but they aren't triggered after that.

thanks for your help.
 
K

ken

The logic behind your expression is that cboHi is 1 or more, and cboLo
is either less than 1 or is "K", right?

As the value can be "K" presumably the data type is text, so try:

[cboHi]>="1" And ([cboLo]<"1" Or [cboLo]="K")

Ken Sheridan
Stafford, England

The conditional formatting is almost working for me. Since the child field
uses a "K" to represent 0, I need something similar to the following, but
the following doesn't work.

expression is:
[cboHi]>=1 And ([cboLo]<1 Or [cboLo]="K")

How can I handle this situation?


Use conditional formatting on the box3, box4, box5, box6, box7, and
box8 controls. The condition for each will be:
Expression is [countLo] = 3 And [countHi] = 8
By clicking the Add button in the conditional formatting dialogue you
can set the controls' BackColor to be different colours for different
combinations of values in the other two controls.
Ken Sheridan
Stafford, England
 

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