E
ED007
I have a form that pulls GRADE and AvgOfASH VALUE from a querry. The GRADE
is shown in the reportheader and the AbgOfASH VALUE is shown in the details
section. I want the AvgOfASH VALUE to show up in red if it is out of spec
and green if it is in spec. The high and low limits are stored in a table
called COMPUND GRADES in the HIGH LIMIT AND LOW LIMIT fields. I thought that
following code using a DlookUp funciton to pull the limits would work and
placed it in the Onformat event of the Details section. It does not get past
the first line of the if staement. Any ideas?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [AvgOfASH VALUE] < DLookup("[LOW LIMIT]", "[COMPOUND GRADES]", "[GRADE] =
" & [GRADE]) Then
With Me![AvgOfASH VALUE]
.ForeColor = vbRed
End With
ElseIf [AvgOfASH VALUE] > DLookup("[HIGH LIMIT]", "COMPOUND GRADES",
"[GRADE] = " & [GRADE]) Then
With Me![AvgOfASH VALUE]
.ForeColor = vbRed
End With
Else
With Me![AvgOfASH VALUE]
.ForeColor = vbGreen
End With
End If
End Sub
is shown in the reportheader and the AbgOfASH VALUE is shown in the details
section. I want the AvgOfASH VALUE to show up in red if it is out of spec
and green if it is in spec. The high and low limits are stored in a table
called COMPUND GRADES in the HIGH LIMIT AND LOW LIMIT fields. I thought that
following code using a DlookUp funciton to pull the limits would work and
placed it in the Onformat event of the Details section. It does not get past
the first line of the if staement. Any ideas?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [AvgOfASH VALUE] < DLookup("[LOW LIMIT]", "[COMPOUND GRADES]", "[GRADE] =
" & [GRADE]) Then
With Me![AvgOfASH VALUE]
.ForeColor = vbRed
End With
ElseIf [AvgOfASH VALUE] > DLookup("[HIGH LIMIT]", "COMPOUND GRADES",
"[GRADE] = " & [GRADE]) Then
With Me![AvgOfASH VALUE]
.ForeColor = vbRed
End With
Else
With Me![AvgOfASH VALUE]
.ForeColor = vbGreen
End With
End If
End Sub