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
| Private Sub Suprimer_Affectation_Click()
Dim OuiNon As Integer
Dim strmysql As String
Dim Numero_puce As String
Dim MyDate As Date
Dim RunMySQL As String
DoCmd.SetWarnings False
Numero_puce = Me.Num_SIM
OuiNon = MsgBox("Est-ce que le matériel est déjà retourné ?", vbYesNo)
If OuiNon = vbYes Then
strmysql = "UPDATE Abonnements SET Abonnements.Statut_Abo = ""Non Affecté"""
strmysql = strmysql & " WHERE (Abonnements.Num_SIM = """
strmysql = strmysql & Numero_puce
strmysql = strmysql & """);"
' DoCmd.RunSQL strmysql
Me.Statut_Affectation = "Non Affecté"
DoCmd.RunCommand acCmdSaveRecord
MyDate = Date$
User = Environ("USERNAME")
RunMySQL = "INSERT INTO [Arch_Affectation] (Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action )"
RunMySQL = RunMySQL & " select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #"
RunMySQL = RunMySQL & MyDate
RunMySQL = RunMySQL & "#, Actif, Statut_Affectation, Commentaire, """
RunMySQL = RunMySQL & User
RunMySQL = RunMySQL & """, #"
RunMySQL = RunMySQL & MyDate
RunMySQL = RunMySQL & "#, ""Supprimer Affectation"""
RunMySQL = RunMySQL & " FROM [Affectation] WHERE [Affectation].Or_Affectation =" & Me.Or_Affectation & ";"
DoCmd.RunSQL RunMySQL
DoCmd.RunSQL " UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =""Non Affecté""" _
& " WHERE Equipement.Num_EMEI='" & Me.Num_EMEI & "'"
ElseIf OuiNon = vbNo Then
strmysql = "UPDATE Abonnements SET Abonnements.Statut_Abo = ""Attente Retour"""
strmysql = strmysql & " WHERE (Abonnements.Num_SIM = """
strmysql = strmysql & Numero_puce
strmysql = strmysql & """);"
' DoCmd.RunSQL strmysql
Me.Statut_Affectation = "Attente Retour"
DoCmd.RunCommand acCmdSaveRecord
MyDate = Date$
User = Environ("USERNAME")
RunMySQL = "INSERT INTO [Arch_Affectation] (Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM, Date_Début, Date_Fin, Actif, Statut_Affectation, Commentaire, Auteur, Date_Maj, Desc_Action )"
RunMySQL = RunMySQL & " select Or_Affectation, USER_ID, PIN_Terminal, PIN_SIM, Coque, Vitre, Support_Vehicule, Num_EMEI,Num_SIM , Date_Début, #"
RunMySQL = RunMySQL & MyDate
RunMySQL = RunMySQL & "#, Actif, Statut_Affectation, Commentaire,"""
RunMySQL = RunMySQL & User
RunMySQL = RunMySQL & """, #"
RunMySQL = RunMySQL & MyDate
RunMySQL = RunMySQL & "#, ""Supprimer Affectation - Attente Retour"""
RunMySQL = RunMySQL & " FROM [Affectation] WHERE [Affectation].Or_Affectation =" & Me.Or_Affectation & ";"
DoCmd.RunSQL RunMySQL
DoCmd.RunSQL " UPDATE [Equipement] INNER JOIN [Affectation] ON [Equipement].Num_EMEI = [Affectation].Num_EMEI SET [Equipement].Statut_Equipement =""Attente Retour""" _
& " WHERE Equipement.Num_EMEI='" & Me.Num_EMEI & "'"
End If |
Partager