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
| Dim db, db1 As DAO.Database
Dim rs, rs1 As DAO.Recordset
Dim strSQL, tempo, strSQL1 As String
Dim myCount, tempo1, tempo2 As Integer
Dim rsCount As Integer
Set db = CurrentDb()
strSQL = "SELECT Sum(Tableau.Heure) AS [SommeDeHeure] FROM Tableau Where (date Like '" & date_atelier.Value & "' and machine='450T2')"
Set rs = db.OpenRecordset(strSQL)
tempo = "450T2"
tempo1 = rs.Fields(0)
rs.Close
Set db = CurrentDb()
strSQL = "SELECT Tableau.Semaine FROM Tableau Where (Tableau.date Like '" & date_atelier.Value & "' or Tableau.Semaine Like '" & semaine_atelier.Value & "' or Tableau.Mois Like '" & mois_atelier.Value & "' or Tableau.Année Like '" & annee_atelier.Value & "') and Tableau.machine='450T2'"
Set rs = db.OpenRecordset(strSQL)
tempo2 = rs.Fields(0)
rs.Close
'affichage du resultat
If 1500 <= tempo1 >= 1440 Then
Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("select * from TableMaintenance")
rs1.AddNew
rs1("Machine").Value = tempo
rs1("Visite num").Value = 1
rs1("Visite planifier Le").Value = tempo2
rs1("Compteur d'Heure").Value = tempo1
rs1.Close
Me.Ctl3450t2.Visible = True
Set db1 = CurrentDb()
strSQL1 = "SELECT Tableau.[Visite realiser Le] FROM TableMaintenance Where TableMaintenance.Machine='450T2' and TableMaintenance.[Visite num] = '1'"
Set rs1 = db1.OpenRecordset(strSQL1)
If (rs1.Fields("[Visite realiser Le]") <> 0) Then
Me.Ctl3450t2.BackColor = "255"
End If
rs1.Close
End If
If 3000 <= tempo1 >= 2880 Then
Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("select * from TableMaintenance")
rs1.AddNew
rs1("Machine").Value = tempo
rs1("Visite num").Value = 2
rs1("Visite planifier Le").Value = tempo2
rs1("Compteur d'Heure").Value = tempo1
rs1.Close
Me.Ctl6450t2.Visible = True
Set db1 = CurrentDb()
strSQL1 = "SELECT Tableau.[Visite realiser Le] FROM TableMaintenance Where TableMaintenance.Machine='450T2' and TableMaintenance.[Visite num] = '2'"
Set rs1 = db1.OpenRecordset(strSQL1)
If (rs1.Fields("[Visite realiser Le]") <> 0) Then
Me.Ctl6450t2.BackColor = "16000"
End If
End If
If 3400 <= tempo1 >= 3320 Then
Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("select * from TableMaintenance")
rs1.AddNew
rs1("Machine").Value = tempo
rs1("Visite num").Value = 3
rs1("Visite planifier Le").Value = tempo2
rs1("Compteur d'Heure").Value = tempo1
rs1.Close
Me.Ctl9450t2.Visible = True
Set db1 = CurrentDb()
strSQL1 = "SELECT Tableau.[Visite realiser Le] FROM TableMaintenance Where TableMaintenance.Machine='450T2' and TableMaintenance.[Visite num] = '3'"
Set rs1 = db1.OpenRecordset(strSQL1)
If (rs1.Fields("[Visite realiser Le]") <> 0) Then
Me.Ctl9450t2.BackColor = "55000"
End If
End If
If tempo1 >= 4760 Then
Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("select * from TableMaintenance")
rs1.AddNew
rs1("Machine").Value = tempo
rs1("Visite num").Value = 4
rs1("Visite planifier Le").Value = tempo2
rs1("Compteur d'Heure").Value = tempo1
rs1.Close
Me.Ctl12450t2.Visible = True
Set db1 = CurrentDb()
strSQL1 = "SELECT Tableau.[Visite realiser Le] FROM TableMaintenance Where TableMaintenance.Machine='450T2' and TableMaintenance.[Visite num] = '4'"
Set rs1 = db1.OpenRecordset(strSQL1)
If (rs1.Fields("[Visite realiser Le]") <> 0) Then
Me.Ctl12450t2.BackColor = "1"
End If
End If |
Partager