Hello,
I'm new to Access and programming in general. I'm trying to understand loops but I'm not making any progress. I'm trying to write a loop to calculate the average of the past 10 Values including the current Value. This is what I have so far.
There are also Fields for "Date" and "Time" if that is useful.
[code]
Dim index As Integer
Dim RollAveTotal As Long
Dim CurrentValue As Variant
Do
'There are 4 possible Grades. I only need "Grade 1"
If Me.Grade = "Grade 1" Then
'Status will be either "Y" or "N". Only Records with "Y" are to be counted. "N"s should be ignored. The "Current
If Me.Status = "Y" Then
RollAveTotal = RollAveTotal + Me.Value
CurrentValue = Me.Value
RollingAverage = (RollAveTotal + Value) / 10
End If
End If
index = index + 1
Loop Until index = 9
[\code]
Thanks for any help or advice!