Bonsoir,
je bloque sur le problème suivante: J'ai créer une page ou sur clique sur un bouton, toutes les factures dont la date d'échéance est dépassé 's-affiche.
je peux cocher le/les clients à qui je veux envoyé une lettre de relance.
au même temps je change le code de fiabilité du client, aussi pour savoir si j'ai déjà envoyé une lettre de relance
Maintenant j'ai une bouton qui va m'ouvrir l'Etat Rappel.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Dim strSql As String Dim strUpd As String DoCmd.SetWarnings False strFacture = Me.Facture1 strIdClient = Me.IdClient1 If Me.chxRappel1 = 0 Then strSql = "UPDATE tbl_Factures SET tbl_Factures.Rappel = 0 WHERE (tbl_Factures.N°Fact = '" & strFacture & "');" DoCmd.RunSQL strSql MsgBox ("Votre commande à été executé!") GoTo Fin Else strSql = "UPDATE tbl_Factures SET tbl_Factures.Rappel = -1 WHERE (tbl_Factures.N°Fact = '" & strFacture & "');" DoCmd.RunSQL strSql MsgBox ("Votre commande à été executé!") End If Select Case Me.Code1 Case "AAA" strSql = "UPDATE tbl_ClientFournisseur INNER JOIN tbl_Factures ON tbl_ClientFournisseur.CodeIdentifient = tbl_Factures.CodeIdentifient SET tbl_ClientFournisseur.Rappelstatus = 'AAB' " & _ "WHERE (((tbl_ClientFournisseur.IdClient)= " & strIdClient & "));" DoCmd.RunSQL strSql Case "AAB" strSql = "UPDATE tbl_ClientFournisseur INNER JOIN tbl_Factures ON tbl_ClientFournisseur.CodeIdentifient = tbl_Factures.CodeIdentifient SET tbl_ClientFournisseur.Rappelstatus = 'ABB' " & _ "WHERE (((tbl_ClientFournisseur.IdClient)= " & strIdClient & "));" DoCmd.RunSQL strSql Case "ABB" strSql = "UPDATE tbl_ClientFournisseur INNER JOIN tbl_Factures ON tbl_ClientFournisseur.CodeIdentifient = tbl_Factures.CodeIdentifient SET tbl_ClientFournisseur.Rappelstatus = 'BBB' " & _ "WHERE (((tbl_ClientFournisseur.IdClient)= " & strIdClient & "));" DoCmd.RunSQL strSql Case "BBB" strSql = "UPDATE tbl_ClientFournisseur INNER JOIN tbl_Factures ON tbl_ClientFournisseur.CodeIdentifient = tbl_Factures.CodeIdentifient SET tbl_ClientFournisseur.Rappelstatus = 'BBB-' " & _ "WHERE (((tbl_ClientFournisseur.IdClient)= " & strIdClient & "));" DoCmd.RunSQL strSql End Select
ça ouvre bien l'Etat avec le client souhaité avec ssfEtat les factures et les montant à échéance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Dim oDb As DAO.Database Dim oRst As DAO.Recordset strSql = "SELECT tbl_ClientFournisseur.IdClient, tbl_ClientFournisseur.Prénom, tbl_ClientFournisseur.Nom, tbl_ClientFournisseur.[e-mail], tbl_ClientFournisseur.Rappelstatus, " & _ "tbl_Factures.N°Fact, tbl_Factures.Payé, Sum(tbl_Factures.MontantVirement) AS SommeDeMontantVirement, Sum(tbl_Factures.Port) AS SommeDePort, tbl_Factures.Rappel " & _ "FROM tbl_ClientFournisseur INNER JOIN tbl_Factures ON tbl_ClientFournisseur.CodeIdentifient = tbl_Factures.CodeIdentifient " & _ "GROUP BY tbl_ClientFournisseur.IdClient, tbl_ClientFournisseur.Prénom, tbl_ClientFournisseur.Nom, tbl_ClientFournisseur.[e-mail], " & _ "tbl_ClientFournisseur.Rappelstatus, tbl_Factures.N°Fact, tbl_Factures.Payé, tbl_Factures.Rappel " & _ "HAVING (((tbl_Factures.N°Fact) Like 'F*') AND ((tbl_Factures.Payé)=No) AND ((tbl_Factures.Rappel)=Yes));" Set oDb = CurrentDb Set oRst = oDb.OpenRecordset(strSql, dbOpenDynaset) If oRst.EOF Then MsgBox "il n'y à pas des clients sélectionné" Else Do While Not oRst.EOF strEmailAddr = oRst(3) strRappelstatus = oRst(4) strFacture = oRst(5) strBody = "Voir fichier attachez, svp" & Chr(13) & Chr(10) & Chr(10) & "Bien à vous" & Chr(13) & Chr(10) & Chr(10) & strSignature Select Case strRappelstatus Case "AAB" strSubject = "Rappel 1" DoCmd.OpenReport "EtatRappel1", acViewReport, , "[IdClient] = " & oRst(0), acWindowNormal Case "ABB" strSubject = "Rappel 2" DoCmd.OpenReport "EtatRappel2", acViewReport, , "[IdClient] = " & oRst(0), acWindowNormal Case "BBB" strSubject = "Mis en demeure" DoCmd.OpenReport "EtatRappel3", acViewReport, , "[IdClient] = " & oRst(0), acWindowNormal End Select oRst.MoveNext Loop End If oRst.Close: Set oRst = Nothing oDb.Close
Mais, quand je pousse sur le bouton Envoyer Mail, il ne change pas les données dans l'Etat et envoyé x-fois le même (la premier) Etat
qqn peux me mettre sur le chemin comment je peux solutioner ce problème svp?
Hans
Partager