Not: tarih alanlarında veri olduğu ve sıralı gittiği varsayılmıştır
Sub VeriDuzen()
t1 = Timer
Dim ADO_RS As Object
Set ADO_RS = CreateObject("adodb.recordset")
SQL = "select [veri],[Kimlik],[Tarih] from Table1 order by [Kimlik]"
CurrentDb.Execute ("update table1 set [Alan1]=0")
ADO_RS.Open SQL, CurrentProject.Connection, 1, 3 ', 1
With ADO_RS 'loop
If Not .BOF And Not .EOF Then
.MoveFirst
xSay = 0
xTrh = Int(.Fields(2))
While (Not .EOF)
If xTrh <> Int(.Fields(2)) Then xSay = 0: xTrh = Int(.Fields(2))
If .Fields(0) <= 20 Then xSay = 0 Else xSay = xSay + 1: CurrentDb.Execute ("update table1 set [Alan1]=" & xSay & " where [Kimlik]=" & .Fields(1)) ' .Fields(1) = xSay
.MoveNext
Wend
End If
End With
Debug.Print Timer - t1
End Sub