In an Access module I'm using this code
x = Forms![Density Test]![No of Test]
For n = 1 To x
Dat = Choose(n, Forms![Density Test]!DENS1, Forms![Density Test]!DENS2, Forms![Density Test]!DENS3, Forms![Density Test]!DENS4, Forms![Density Test]!DENS5, Forms![Density Test]!DENS5, Forms![Density Test]!DENS6, Forms![Density Test]!DENS7, Forms![Density Test]!DENS8, Forms![Density Test]!DENS9, Forms![Density Test]!DENS10)
S1 = S1 + Dat
Next
Forms![Density Test]![AvD] = S1 / x
Forms![Density Test]![Av Density] = Forms![Density Test]![AvD]
I get an answer of an average that is 2.334 when in reality the average is 2.327 from 6 values of 2.333, 2.287, 2.365, 2.264, 2.377, and 2.339.
x = 6
Any idea why?
Is this code wrong?
TIA Reece
x = Forms![Density Test]![No of Test]
For n = 1 To x
Dat = Choose(n, Forms![Density Test]!DENS1, Forms![Density Test]!DENS2, Forms![Density Test]!DENS3, Forms![Density Test]!DENS4, Forms![Density Test]!DENS5, Forms![Density Test]!DENS5, Forms![Density Test]!DENS6, Forms![Density Test]!DENS7, Forms![Density Test]!DENS8, Forms![Density Test]!DENS9, Forms![Density Test]!DENS10)
S1 = S1 + Dat
Next
Forms![Density Test]![AvD] = S1 / x
Forms![Density Test]![Av Density] = Forms![Density Test]![AvD]
I get an answer of an average that is 2.334 when in reality the average is 2.327 from 6 values of 2.333, 2.287, 2.365, 2.264, 2.377, and 2.339.
x = 6
Any idea why?
Is this code wrong?
TIA Reece