Originally Posted by
June7
Calculations dependent on values in another record of same table are difficult. You essentially want to assign a value to record groups. Review:
http://allenbrowne.com/ranking.html
Thanks! I had someone on another forum respond with a solution (Below). Thanks for you help!
Code:
Dim rs As DAO.Recordset
Dim strSQL As String
Dim holdA, holdB, Hold
XstrSQL = "SELECT A, X, B FROM YourTable ORDER BY A, B"
Set rs = CurrentDB.OpenRecordset( strSQL, dbOpenDynaset)
holdA = ""
holdB = ""
holdX = 0
Do Until rs.EOF
rs.Edit
If rs!A <> holdA Then
holdX = 1
ElseIf rs!B <> holdB Then
holdX = holdX + 1
End If
rs!X = holdX
holdA = rs!A
holdB = rs!B
rs.Update
rs.MoveNext
Loop