Function cdane(aec)
Dim dbs As DAO.Database, atable As Recordset, rs As DAO.Recordset
Dim j, k, m As Integer
Dim cum, cda As Long
Static tota(99)
Set dbs = CurrentDb
Set atable = dbs.OpenRecordset("liste des cols", dbOpenSnapshot)
Set rs = dbs.OpenRecordset("cdparan", dbOpenTable, dbDenyRead)
rs.Index = "PrimaryKey"
For j = 0 To 99
tota(j) = 0
Next
Do Until atable.EOF
cda = cdan(atable![Cols Durs années précéd], atable![altit], atable![année], atable![cd], aec)
atable.MoveNext
For j = 0 To 99
tota(j) = tota(j) + totcd(j)
Next
Loop
cum = 0
For j = 0 To 99
rs.MoveFirst
rs.Edit
rs.Seek "=", j
rs![Mpan] = tota(j)
rs![An 2000] = (j + 40) Mod 100 + 1960
rs.Update
' Debug.Print j, tota(j)
cum = cum + tota(j)
cdane = cum
Next
rs.Edit
rs.Seek "=", 100
rs![Mpan] = cum
rs.Update
rs.Close
End Function