Hi,
I have six controls on a form, the value can be a whole number or 0.5 These are all number type, double, in the table.
My code (see below) sums up the whole numbers but ignores the fraction. Any advice you can give would be great. Thanks
Private Sub calcScore()
Dim i, j, score As Integer
Dim r(6) As Variant
r(1) = Me![M].Value
r(2) = Me![O].Value
r(3) = Me![JPS].Value
r(4) = Me![CA].Value
r(5) = Me![HH].Value
r(6) = Me![PC].Value
For i = 0 To 6
If IsNull(r(i)) Then
r(i) = 0
End If
Next
For j = 0 To 6
score = score + r(j)
Next
Me!Sum = score
End Sub
I have six controls on a form, the value can be a whole number or 0.5 These are all number type, double, in the table.
My code (see below) sums up the whole numbers but ignores the fraction. Any advice you can give would be great. Thanks
Private Sub calcScore()
Dim i, j, score As Integer
Dim r(6) As Variant
r(1) = Me![M].Value
r(2) = Me![O].Value
r(3) = Me![JPS].Value
r(4) = Me![CA].Value
r(5) = Me![HH].Value
r(6) = Me![PC].Value
For i = 0 To 6
If IsNull(r(i)) Then
r(i) = 0
End If
Next
For j = 0 To 6
score = score + r(j)
Next
Me!Sum = score
End Sub