Hi there!...I have a fairly easy problem(i think!), Just wont work..
Up to now my basic average system was just fine.. I have 8 text boxes that HAD to be filled before any calculations could begin!
Now they don't all have to be filled so how could i get the average of only the text boxes that have been filled??!
Does anyone know if this this should work??
Ive tagged all my input text boxes with a "T" and put this code on the on-current property of the form.
this code simply counts all the empty textboxes from my tagged group and that value is then 'intC'
Then for my average function I have
Can i just subtract intC from the total number like that?
Am i wording it wrong or should i be calling newAVG somewhere else? If so please help..
Thanks
Up to now my basic average system was just fine.. I have 8 text boxes that HAD to be filled before any calculations could begin!
Code:
.AVG = (.x1 + .x2 + .x3 + .x4 + .x5 + .x6 + .x7 + .x8) / 8
Now they don't all have to be filled so how could i get the average of only the text boxes that have been filled??!
Does anyone know if this this should work??
Ive tagged all my input text boxes with a "T" and put this code on the on-current property of the form.
this code simply counts all the empty textboxes from my tagged group and that value is then 'intC'
Code:
Private Sub newAVG()
Dim intC As Integer
Dim ctrl As Control
intC = 0
For Each ctrl In Me.Controls
If ctrl.Tag = "T" Then
If IsNull(ctrl) Then
intC = intC + 1
End If
End If
Next
End Sub
Then for my average function I have
Code:
.AVG = (.x1 + .x2 + .x3 + .x4 + .x5 + .x6 + .x7 + .x8) / (8 - intC)
Can i just subtract intC from the total number like that?
Am i wording it wrong or should i be calling newAVG somewhere else? If so please help..
Thanks