Private Sub Case_Number_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("A", dbOpenDynaset)
Dim i As Integer
Dim Case_Number As Integer
Dim Billing_ID As Integer
i = 1
With rs
Billing_ID = 0
Do While Not rs.EOF
if billing_Id = 0 then .movefirst
.Edit
If !Billing_ID <> Billing_ID Then
Case_Number = 0
Billing_ID = !Billing_ID
End If
Case_Number = Case_Number + 1
!Case_Number = Case_Number
!LineNumber = i
i = i + 1
.Update
.MoveNext
Loop
.Close
End With
End Sub
|