form detail section background color

G

Gator

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
 
D

Dennis

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.
 
M

Mike Painter

Text fields holding numbers may lad to roundoff or trunction errors.
In general a number field will not have this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top