1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Public Function Nsuivants(ladate As Date, codeid As String, nbjours_f As Byte)
Dim moy As Double
Dim rsx As DAO.Recordset
Dim strx As String
ladate2 = ladate + nbjours_f
strx = "SELECT (rq.Toto),rq.date AS X FROM (SELECT TOP " & (nbjours_f - 1) & " MAtable.TOTO ,MAtable.date FROM MAtable WHERE (((MAtable.date)<=#" & Month(ladate2) & "/" & Day(ladate2) & "/" & Year(ladate2) & "# and MaTable.codeid=""" & codeid & """)) ORDER BY MAtable.date DESC) AS rq;"
Set rsx = CurrentDb.OpenRecordset(strx)
a = rsx(0)
rsx.MoveLast
On Error Resume Next
Nsuivants = a / rsx(0) - 1
Set rsx = Nothing
End Function |
Partager