How do you set field colrs based on a formula.
I primarily took this one from the on-line help, but I can't get it to work. This is in a function and "Fld" is passed to the function as the field name. I use A to capture the ME!Fld. However at run time A gets converted to the value of the expression "RGB(255, 0, 0)" or 255. What I want to do is set the field format. I know there is a way.
fld = "Me!" & fld
A = fld
Dim lngRed As Long, lngYellow As Long, lngWhite As Long, lngBlack As Long
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
With rst
.Edit
If strPart < !Cur_Val Then
A.BorderColor = lngRed
A.ForeColor = lngRed
A.BackColor = lngYellow
Else
A.BorderColor = lngBlack
A.ForeColor = lngBlack
A.BackColor = lngWhite
End If
.Update
End With
I primarily took this one from the on-line help, but I can't get it to work. This is in a function and "Fld" is passed to the function as the field name. I use A to capture the ME!Fld. However at run time A gets converted to the value of the expression "RGB(255, 0, 0)" or 255. What I want to do is set the field format. I know there is a way.
fld = "Me!" & fld
A = fld
Dim lngRed As Long, lngYellow As Long, lngWhite As Long, lngBlack As Long
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
With rst
.Edit
If strPart < !Cur_Val Then
A.BorderColor = lngRed
A.ForeColor = lngRed
A.BackColor = lngYellow
Else
A.BorderColor = lngBlack
A.ForeColor = lngBlack
A.BackColor = lngWhite
End If
.Update
End With