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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
| Dim numDev As Variant
Dim UP As Variant
Dim Service As Variant
Dim Ligne As Variant
Dim eqp As Variant
Dim dateEvt As Variant
Dim dateAtt As Variant
Dim dateCcl As Variant
Dim dateSld As Variant
Dim annulee As Integer
Dim prodSO As Variant
Dim refSO As Variant
Dim lotSO As Variant
Dim prodPF As Variant
Dim refPF As Variant
Dim lotPF As Variant
Dim typeDev As Variant
Dim numInv As Variant
Dim descDef As Variant
Dim descAct As Variant
Dim evalDev As Variant
Dim respAct As Variant
Dim actPrev As Variant
sql1 = "SELECT * FROM Deviation In '" & ANCIENNE_BDD & "'"
Set verif = CurrentDb.OpenRecordset(sql1)
Debug.Print "*** debut ***"
While Not verif.EOF
Service = Null
Ligne = Null
eqp = Null
dateEvt = Null
dateAtt = Null
dateCcl = Null
dateSld = Null
prodSO = ""
refSO = ""
lotSO = ""
prodPF = ""
refPF = ""
lotPF = ""
numInv = ""
descAct = ""
evalDev = ""
respAct = ""
actPrev = ""
numDev = verif.Fields(0)
UP = verif.Fields(2)
If Not IsNull(verif.Fields(3)) Then
Service = verif.Fields(3)
End If
If Not IsNull(verif.Fields(4)) Then
Ligne = verif.Fields(4)
End If
If Not IsNull(verif.Fields(5)) Then
eqp = verif.Fields(5)
End If
If (verif.Fields(10) = True) Then
annulee = 1
End If
If Not IsNull(verif.Fields(11)) Then
prodSO = verif.Fields(11)
End If
If Not IsNull(verif.Fields(12)) Then
refSO = verif.Fields(12)
End If
If Not IsNull(verif.Fields(13)) Then
lotSO = verif.Fields(13)
End If
If Not IsNull(verif.Fields(14)) Then
prodPF = verif.Fields(14)
End If
If Not IsNull(verif.Fields(15)) Then
refPF = verif.Fields(15)
End If
If Not IsNull(verif.Fields(16)) Then
lotPF = verif.Fields(16)
End If
typeDev = verif.Fields(17)
If Not IsNull(verif.Fields(18)) Then
numInv = verif.Fields(18)
End If
If Not IsNull(verif.Fields(19)) Then
descDef = "AA"
' descDef = verif.Fields(19)
' descDef = Replace(descDef, "'", " ")
End If
If Not IsNull(verif.Fields(20)) Then
descAct = "BB"
' descAct = verif.Fields(20)
' descAct = Replace(descAct, "'", " ")
End If
If Not IsNull(verif.Fields(21)) Then
evalDev = "CC"
' evalDev = verif.Fields(21)
' evalDev = Replace(evalDev, "'", " ")
End If
If Not IsNull(verif.Fields(22)) Then
respAct = verif.Fields(22)
respAct = Replace(respAct, "'", " ")
End If
If Not IsNull(verif.Fields(23)) Then
actPrev = "FF"
' actPrev = verif.Fields(23)
' actPrev = Replace(actPrev, "'", " ")
End If
Dim i As Integer
If (Not IsNull(eqp) And eqp <> "" And eqp <> "0") Then
eqp = RechercherIDEquipement(CStr(eqp))
End If
If (Not IsNull(Ligne) And Ligne <> "" And Ligne <> "0") Then
Ligne = RechercherIDLigne(CStr(Ligne))
End If
If (Not IsNull(respAct) And respAct <> "" And respAct <> "0") Then
respAct = RechercherIDDemandeur(CStr(respAct))
End If
If (Not IsNull(Service) And Service <> "" And Service <> "0") Then
Service = RechercherIDService(CStr(Service))
End If
typeDev = RechercherIDType(CInt(typeDev))
sqlTmp = "INSERT INTO Deviation (numeroDeviation, UP, idLigne, idService, idEquipement, idType, idDemandeur, dateEvenement, dateAttribuee, dateConclue, dateSoldee, numInvAnalytique, descDefaut, descAction, evaluation, actionPreventive, estAnnulee, nomSo, refSO, lotSo, nomPF, refPF, lotPF) VALUES (" & numDev & ",'" & UP & "', " & Ligne & ", " & Service & ", " & eqp & ", " & typeDev & ", " & respAct & ", '" & dateEvt & "', '" & dateAtt & "', '" & dateCcl & "', '" & dateSld & "', '" & numInv & "', '" & descDef & "', '" & descAct & "','" & evalDev & "','" & actPrev & "', " & annulee & ", '" & prodSO & "', '" & refSO & "', '" & lotSO & "', '" & prodPF & "', '" & refPF & "', '" & lotPF & "')"
CurrentDb.Execute (sqlTmp)
verif.MoveNext
Wend |
Partager