Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formating Help Needed

Status
Not open for further replies.

HJessen

Technical User
Dec 18, 2002
39
US
I have a report that produces a datasheet output and covers different types of training that each employee has taken. Each of the training topics has a different grade spread.

i.e.;
Topic Grade Range
Shop Safety 50-41 (Exceptional)
40-31 (Passing)
30-21 (Very Low)
20-0 (Fails)
Vehicle Care 100-90 (Exceptional)
89-70 (Passing)
69-50 (Very Low)
49-0 (Fails)

What I need is a conditional format that looks at the topic and based on the grade from that particular topic changes the background and text color in the field. (The grade field is numeric.)

Basicly I need:
If topic = "Shop Safety" then do
if grade is GT 41 then
background = green
text = black bold
else if grade is LT 19 then
background = red
text = yellow/bold
Else If topic = "Vehicle Care" then do
if grade is GT 89 then
background = green
text = black bold
else if grade is LT 48 then
background = red
text = yellow/bold
END IF

Can anyone help me? I am NOT VBA literate and cannot seem to locate anything that will help me in the texts I have for reference.

THANKS.
H. Jessen
"Now I know more, and I feel dummer"
 
Try putting this in the Format Event for the Detail Section of the Report.
If topic = "Shop Safety" then
If grade is >= 41 then
Me.[grade].backcolor = vbgreen
Me.[grade].Fontweightt = 800
ElseIf grade is < = 20 Then
Me.[grade].backcolor = vbred
Me.[grade].ForeColor = vbyellow
Me.[grade].Fontweight = 800
Else
Me.[grade].backcolor = vbWhite
Me.[grade].Fontweight = 400
End If
ElseIf topic = &quot;Vehicle Care&quot; then
If grade is > 89 Then
Me.[grade].backcolor = vbgreen
Me.[grade].Fontweightt = 800
ElseIf grade is < = 49 Then
Me.[grade].backcolor = vbred
Me.[grade].ForeColor = vbyellow
Me.[grade].Fontweight = 800
Else
Me.[grade].backcolor = vbWhite
Me.[grade].Fontweight = 400
End If
END IF

Paul

 
Paul,

Thank You.

Now for another question - Where can I find the object(?) names for use in VBA? (i.e. backcolor, fontweight, etc.)

This always seems to be my big hang up when I try to do these things.

Thanks.

H. Jessen
&quot;Now I know more, and I feel dummer&quot;
 
There is a property box that lists the property names when you open a form or report in design view. You can go to the property, click on the line next to it and then press F1. That will open the help file for that property. Some times the name of the property and the way you refer to it in code are slightly different.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top