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
| Sub SuppAffaireDetail()
Dim Cnt As ADODB.Connection, Rst As ADODB.Recordset, MySQL As String
Dim LaCo As String, LaDate As Date, LaRess As String, LeTemps As Date, Heure As Date
Dim LeClient As String, Lentite As String, LePoste As String, LeService As String
LaCo = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 0)
LaDate = CDate(CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 1))
LaRess = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 2)
'LeTemps = CDate(CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 3))
Heure = CDate(CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 4))
'LeClient = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 5)
'Lentite = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 6)
'LePoste = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 7)
'LeService = CorrectJour.ListBox1.List(CorrectJour.ListBox1.ListIndex, 8)
LaDate = Format(LaDate, "yyyy-mm-dd") '=============================Format date ACCES date du jour de travail
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set Cnt = New ADODB.Connection '..................................................On fixe la variable.....
Set Rst = New ADODB.Recordset '...................................................On fixe la variable.....
Cnt.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & URL_BASE & ";" '......On ouvre la connection à la base.....
'----------Suppression dans la base Affaires_Details----------
MySQL = "DELETE FROM Affaires_Details " & _
"WHERE (Affaires_Details.N°_CO='" & LaCo & "') AND (Affaires_Details.Date_Fab=#" & LaDate & "#) AND (Affaires_Details.Ressources='" & LaRess & "') AND (Affaires_Details.Heure_Saisie=#" & Heure & "#) "
Rst.Open MySQL, Cnt, adOpenStatic
Set Rst = Nothing
'----------Suppression dans la base Paniers----------
'If LaCo = "TG023" Then
'Set Rst = New ADODB.Recordset '...............................................On fixe la variable.....
'MySQL = "DELETE FROM Paniers " & _
'"WHERE (Paniers.Panier_Ress='" & LaRess & "') AND (Paniers.Panier_Date=#" & LaDate & "#) "
'Rst.Open MySQL, Cnt, adOpenStatic
'Set Rst = Nothing
'End If
Cnt.Close
Set Cnt = Nothing
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub |
Partager