Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate score with fractions and whole nums

Status
Not open for further replies.

ad2

Technical User
Dec 31, 2002
186
US
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
 




Hi,
Code:
[s]
Dim score As Integer [/s]'Hmmmmm this is a problem
Dim score as double

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top