I getting erroneous results from a simple add and subtract loop. I'm sure it's something simple, but I don't see it.
On the form is an array of textboxes and a label
if txtfld(1) = 10Code:private sub xxxxxxxx Dim Tot As Double Dim X As Integer Tot = 0 For X = 1 To 8 If TxtFld(X).Text <> "" Then If X <= 3 Then Tot = Tot + CDbl(TxtFld(X).Text) Else Tot = Tot - CDbl(TxtFld(X).Text) End If End If Next LblBal.Caption = CStr(Tot) end sub
& txtlfd(4) = 5
& txtfld(6) = 5.1
then it should be
10 - 5 - 5.1 = -0.1
but I get -9.99999 ?????
what gives?
-RT
The actual answer given by vb is -9.99999999999943E-02




Reply With Quote