form detail section background color

  • Thread starter Thread starter Gator
  • Start date Start date
As I scroll through records....several of them highlight the detail
background to red even though the two controls have the same number.
The controls Total and TotalAbat are calculated controls....for example.....
control Source =Round((nz(txt1),0)+(nz(txt2),0),2)
???
here is the code

Private Sub Form_Current()

If Assessor - Total <> 0 Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = -2147483633
End If

If AssessorAbate - TotalAbat <> 0 Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = -2147483633
End If

End Sub
 
Have you coded a Debug.Print of the values you're getting? that way you could
look at them as you scroll through. Also, there have been times when I had to
create a separate variable to hold the results of the calculation, and test
that variable rather than "doing the math" in the IF. I have NO IDEA why I
had to do that, but it worked.
 
Text fields holding numbers may lad to roundoff or trunction errors.
In general a number field will not have this problem.
 
Back
Top