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
| Function EnvoiRappel()
Dim Sql As String
Dim Commandes As String
If DCount("*", "Tt_MailInfo_CDP") = 0 Then Exit Function
Mail_object = "Dossiers 9IPNET en attente dun retour dinformation"
Mail_intro = "[Ceci est un message de rappel, généré automatiquement]"
Mail_intro = Mail_intro & vbCrLf
Mail_intro = Mail_intro & vbCrLf
Mail_intro = Mail_intro & "Bonjour,"
Mail_intro = Mail_intro & vbCrLf & vbCrLf
Mail_intro = Mail_intro & "La cellule NOE t'a sollicité pour des informations relatives aux commandes suivantes, actuellement en rejet de production :"
Mail_conclu = "Nous restons à ta disposition pour traiter cette réinjection, une fois les informations requises connues."
Mail_conclu = Mail_conclu & vbCrLf & vbCrLf
Mail_conclu = Mail_conclu & "Merci de votre compréhension."
Mail_conclu = Mail_conclu & vbCrLf & vbCrLf
Mail_conclu = Mail_conclu & "Team NOE"
Sql = "Select distinct Adresse_Mail from Tt_MailInfo_CDP;"
Set CDP = CurrentDb.OpenRecordset(Sql, dbOpenDynaset)
CDP.MoveFirst
With CDP
Do While Not CDP.EOF
Commandes = ""
Sql = "Select * from Tt_MailInfo_CDP where Adresse_Mail =" & Chr(34) & CDP!Adresse_Mail & Chr(34) & ";"
Set mail = CurrentDb.OpenRecordset(Sql, dbOpenDynaset)
mail.MoveFirst
With mail
Do While Not mail.EOF
Commandes = Commandes & vbCrLf & vbCrLf & Chr(9) & "-" & mail![RefLdcom] & "-" & mail![MASTER_ID] & "-" & mail![Client] & "-" & mail![Noms_Prenoms]
'MAJ de la date
Sql = "UPDATE Tt_Reporting_JJ SET Tt_Reporting_JJ.Date_Mail_CDP = Now(), Tt_Reporting_JJ.Commentaires_Noe = " & Chr(34) & "Prise en charge par le CDP" & Chr(34) & ", Tt_Reporting_JJ.ATTCDP = True WHERE Tt_Reporting_JJ.RefLdcom= " & Chr(34) & mail!RefLdcom & Chr(34) & ";"
DoCmd.RunSQL Sql
mail.MoveNext
Loop
End With
mail.Close
Envoimail:
Sql = "select superieur from tb_cdp where adresse_mail like " & Chr(34) & CDP!Adresse_Mail & Chr(34) & " ; "
Set sup = CurrentDb.OpenRecordset(Sql, dbOpenDynaset)
'Mail_Superieur = sup!Superieur'
Mail_noe = "gen-01361@neufcegetel.fr"
Mail_copy = Mail_noe & ";"
Mail_Corps = Mail_intro & Commandes & vbCrLf & vbCrLf & vbCrLf & Mail_conclu
'DoCmd.SendObject , acSendNoObject, , "madly.fidele@sfr.com", , , Mail_object, Mail_Corps, False'
DoCmd.SendObject , acSendNoObject, , CDP!Adresse_Mail, Mail_copy, , Mail_object, Mail_Corps, False
CDP.MoveNext
Loop
End With
End Function |
Partager