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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
| Private Sub Commande57_Click()
Dim db As DAO.Database
Dim rst As Recordset, rstDes As Recordset
Dim MyChaine As String
Dim MyResult() As String
Dim inti As Integer
Dim injour As Integer
Dim vajpre As Variant
Dim strjourj As String
Dim i As Integer
Set rst = Current.db.OpenRecordset("RDVReccurrenntTraitement")
Set rstDes = Current.db.OpenRecordset("RDVReccurrentFini")
With rsSource
On Error Resume Next
.MoveLast
.MoveFirst
'vérifier si la table source n' est pas vide
If .BOF And .EOF Then
MsgBox "La Table RDVReccurrentTraitement est vide."
Exit Sub
End If
On Error GoTo err_insert
'On parcours la table source,et on insère un à un toutes les lignes
Do While Not .EOF
i = i + 1
rstDest.AddNew
rstDest!Sujet = rst!Sujet
rstDest!Debut = rst!Debut
rstDest!fin = rst!fin
rstDest!Description = rst!Description
rstDest!lieu = rst!lieu
rstDest!TypeInterval = rst!TypeInterval
rstDest!NbReccurrence = rst!NbReccurrence
rstDest!Rappel = rst!Rappel
rstDest!BRappel = rst!BRappel
rstDest!JourCompl = rst!JourCompl
rstDest!Participant = rst!Participant
rstDest!Organisateur = rst!Organisateur
rstDest!Destinataires = rst!Destinataires
rstDest!HeureDebut = rst!HeureDebut
rstDest!HeureFin = rst!HeureFin
rstDest!Exception = rst!Exception
rsDest!Dureeperiodicite = rst!Dureeperiodicite
rstDest!Interval = rst!Interval
rstDest!JoursMois = rst!JoursMois
rstDest!Mois = rst!Mois
rstDest!DureeRDV = rst!DureeRDV
rstDest!NbJours = rst!NbJours
rstDest!Compagnies = rst!Compagnies
rstDest!Importance = rst!Importance
rstDest!CrietereDiffussion = rst!CritereDiffussion
rstDest!Disponibilite = rst!Disponibilite
rstDest!TypeReccurrence = rst!TypeReccurrence
Set MyChaine = rst.[JoursSemaine] 'Recupere le champs jour de l'enregistrement en cour''JE N'ARRIVE PAS A DEFINIR QUE MYCHAINE ET EGALE AU CHAMPS JoursSemaine DE L'ENREGISTREMENT EN COURS'
Set MyResult = Split(strMyChaine, ",")
For inti = 0 To (rst![NbJour] - 1) '-1 pour compensser le 0'
'Debug'
Next inti
'Recherche la valeur de J -1 de l'enregistrement en cour'
Set vajpre = RechDom ("JoursSemaine","RDVReccurrentTraitement",""Sujet"=rst![Sujet] & [NbOccurrence]=(rst![NbOccurrence])-1")'J'AI UNE ERREUR DE SEPARATEUR DE LISTE SUR SUJET'
'Compare le jour precedent a la liste des resultat des jour concernee et renvoie une valeur numerique'
If vajpre = strMyResult(0) Then
injour = 0
ElseIf vajpre = strMyResult(1) Then
injour = 1
ElseIf vajpre = strMyResult(2) Then
injour = 2
ElseIf vajpre = strMyResult(3) Then
injour = 3
ElseIf vajpre = strMyResult(4) Then
injour = 4
ElseIf vajpre = strMyResult(5) Then
injour = 5
ElseIf vajpre = strMyResult(6) Then
injour = 6
'Renvoie le jour J de l'enregistrement par rapport au dernier enregistrement'
If MyResult() = "" Then ' Si MyResult est null alors on recommence au tout premier jour concernee'
strMyResult() = strMyResult(0)
If injour = 0 Then
strjourj = strMyResult(1)
ElseIf injour = 1 Then
strjourj = strMyResult(2)
ElseIf injour = 2 Then
strjourj = strMyResult(3)
ElseIf injour = 3 Then
strjourj = strMyResult(4)
ElseIf injour = 4 Then
strjourj = strMyResult(5)
ElseIf injour = 5 Then
strjourj = strMyResult(6)
ElseIf injour = 6 Then
strjourj = strMyResult(0)
rstDest!JoursSemaine = rst!strjourj
Update
'ligne suivante
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
rstDest.Close
Set rstDest = Nothing
MsgBox "Terminé.."
Exit Sub
'encas d' erreur
err_insert:
MsgBox Err.Description
End Sub
End Sub |
Partager