This is air code it may need cleaning up a bit
Then on the Current of the form and on After Update of all 8 fields use
Phil
Code:
Function GetAverage() as Single
Dim Total as Single
Dim Divisor as Integer
Dim i as Integer
' Loop through all the controls with a name starting with "LineSpeed" or LineSpeedMeters - what ever you are using
For i = 1 to 8
If Not IsNull(Me.Controls("LineSpeed" & Cstr(i))) then
Divisor = Divisor + 1
End If
Next i
If Divisor = 0 then ' All blank
GetAverage = Null
Exit Function
End if
' Now get the totals using a similar method
For i = 1 to 8
If Not IsNull(Me.Controls("LineSpeed" & Cstr(i))) then
Total = Total + Me.Controls("LineSpeed" & cstr(i))
End If
Next i
GetAverage = Total / Divisor
Exit Function
Code:
Me!TotalLineSpeed = GetAverage()
Comment