Нумерация записей в запросе по аргументу ID
Public Function Numeration(recID As Variant) As Long
Static n As Long
Static id As Long
On Error GoTo Numeration_Err
If id <> recID Then
id = CLng(recID)
n = 1
Else
n = n + 1
End If
Numeration = n
Numeration_Bye:
Exit Function
Numeration_Err:
Err.Clear
Numeration = 0
Resume Numeration_Bye
End Function
Получим:

|