1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| im con As ADODB.Connection
Dim rspm As ADODB.Recordset
Dim rsAL As ADODB.Recordset
'
Set con = CurrentProject.Connection
Set rspm = New ADODB.Recordset
Set rsAL = New ADODB.Recordset
'creation table alerte
DoCmd.RunSQL "drop table TabAlertEch"
DoCmd.RunSQL " create table TabAlertEch" & _
" (N_PERMIS FLOAT,DELAIS NVARCHAR(40), pays NVARCHAR (40))"
'
rspm.Open "[TabPermManagem]", con, 1, 3
rsAL.Open "[TabAlertEch]", con, 1, 3
'
t = 0
For t = 90 To 45 Step -15
N = 0
rspm.MoveFirst
Do While rspm.EOF = False
PAYS = rspm("pays")
adm = rspm("sit_admin_")
'
If adm = "a" Or adm = "p" Or adm = "j" Then
GoTo suite1
End If
'
If PAYS <> "maroc" Then
GoTo suite1
End If
nn = rspm("n_permis")
PR1 = rspm("pr1")
e1 = PR1 - Date
PR2 = rspm("pr2")
e2 = PR2 - Date
PE1 = rspm("pe1")
e3 = PE1 - Date
PE2 = rspm("pe2")
e4 = PE2 - Date
PE3 = rspm("pe3")
e5 = PE3 - Date
PE4 = rspm("pe4")
e6 = PE4 - Date
proro = rspm("prorogation")
e7 = proro - Date
'
If e1 <= t And e1 >= t - 5 Or _
e2 <= t And e2 >= t - 5 Or _
e3 <= t And e3 >= t - 5 Or _
e4 <= t And e4 >= t - 5 Or _
e5 <= t And e5 >= t - 5 Or _
e6 <= t And e6 >= t - 5 Or _
e7 <= t And e7 >= t - 5 Or _
e8 <= t And e8 >= t - 5 _
Then
N = N + 1
End If
suite1:
rspm.MoveNext
'If nn = 3144 Then
'''debug.Print n; Date; "_"; t; e1; e2; e3; e4; e5; e6; e7; "____"; e4
'End If
Loop
'debug.Print pays
rsAL.AddNew
rsAL("N_permis") = N
rsAL("delais") = "Dans " & t & " à " & t - 5 & " jours"
rsAL("pays") = "maroc"
rsAL.Update
Debug.Print DELAIS
Next
'________
t = 0
N = 0
For t = 180 To 30 Step -30
N = 0
rspm.MoveFirst
Do While rspm.EOF = False
nn = rspm("n_permis")
PAYS = rspm("pays")
''debug.Print pays
If PAYS = "maroc" Then
GoTo suite2
End If
dlimite = rspm("d_limite")
'debug.Print t
e8 = dlimite - Date
If e8 <= t And e8 >= t - 5 Or e8 <= i And e8 >= i - 5 Then
N = N + 1
'
''debug.Print n; "__"; t; "__"; t - 5; "___"; nn; "__"; e8
End If
Loop
'
suite2:
rspm.MoveNext
'Loop
'
'debug.Print N; "__"; t; "__"; t - 5; "___"; nn; "__"; e8
rsAL.AddNew
rsAL("N_permis") = N
rsAL("delais") = "Dans " & t & " jours"
rsAL("pays") = "International"
rsAL.Update
Next
con.Close
Set con = Nothing
Set rsAL = Nothing
Set rspm = Nothing
'
End Sub |
Partager