Need help with conditional Formating.

tucker61

Registered User.
Local time
Yesterday, 20:52
Joined
Jan 13, 2008
Messages
341
Hi guys, trying to conditional format a field if the value is <> a set tolerance.

I have got so far, My TBControlMeasurement = 93, My Tolerance is 2, so i have a upper and lower limit set,
So if the Value in Sample_1 is either higher than the upperlimit, or lower than the lower limit i would want this to turn red.

I need to do this for 15 fields on the Form (Sample 1-15) so not sure what is the easiest way to do this as well.


Code:
Private Sub Sample_1_AfterUpdate()
Dim upperlimit As Integer
Dim lowerlimit As Integer
upperlimit = TBControlMeasurement + Tolerance
lowerlimit = TBControlMeasurement - Tolerance

With [Sample_1].FormatConditions
.Delete
With .Add(acExpression, acEqual, "(([upperlimit]-[Sample_1])>0)")
.BackColor = vbRed
End With
End With
End Sub
 
Hi guys, trying to conditional format a field if the value is <> a set tolerance.

I have got so far, My TBControlMeasurement = 93, My Tolerance is 2, so i have a upper and lower limit set,
So if the Value in Sample_1 is either higher than the upperlimit, or lower than the lower limit i would want this to turn red.

I need to do this for 15 fields on the Form (Sample 1-15) so not sure what is the easiest way to do this as well.


Code:
Private Sub Sample_1_AfterUpdate()
Dim upperlimit As Integer
Dim lowerlimit As Integer
upperlimit = TBControlMeasurement + Tolerance
lowerlimit = TBControlMeasurement - Tolerance

With [Sample_1].FormatConditions
.Delete
With .Add(acExpression, acEqual, "(([upperlimit]-[Sample_1])>0)")
.BackColor = vbRed
End With
End With
End Sub
Wouldn't you need code like that on form load?
 

Users who are viewing this thread

Back
Top Bottom