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
|
Function rechercheilotage()
Dim Db As Database
Dim Rs1 As DAO.Recordset
Dim Rs2 As DAO.Recordset
Dim ref_nat
Dim NomCat As Variant
Dim RefNat As Variant
Dim Delais As Variant
Dim IlotIDF As Variant
Dim IlotOrefi As Variant
Dim NonIlot As Variant
Dim txt
'Instancie la base de données
Set Db = CurrentDb
'Ouvre le recordset basé sur la requête "recherche_délai"
Set Rs1 = Db.OpenRecordset(Db.QueryDefs("recherche_delais").SQL, dbOpenDynaset)
'Set Rs1 = Db.OpenRecordset("SELECT Delais.N°, Delais.[Ilotage Soisson_Choisy], Delais.[Ilotage regions], Delais.[Reseau Orefi], Delais.[Non iloté], Delais.NomCat, Delais.NomRefNat, Delais.NomDelais FROM Delais")
'Stocke dans les variables les données de la table Délais
With Rs1
NomCat = .Fields("NomCat").Value
RefNat = .Fields("NomRefNat").Value
Delais = .Fields("NomDelais").Value
IlotIDF = .Fields("Ilotage Soisson_Choisy").Value
IlotOrefi = .Fields("Reseau Orefi").Value
NonIlot = .Fields("Non iloté").Value
.Close
End With
Set Rs2 = Db.OpenRecordset("UPDATE (SELECT [" & NomCat & "].[" & RefNat & "], [Iloteidf-01].[ref nat x], [Iloteidf-01].[Total], [" & NomCat & "].[" & Delais & "] FROM [" & NomCat & "] LEFT JOIN [Iloteidf-01] ON [" & NomCat & "].[" & RefNat & "] = [Iloteidf-01].[ref nat x] WHERE ([Iloteidf-01].[Total])='O'), Delais SET [" & NomCat & "].[" & Delais & "] = [Delais].[Ilotage Soisson_Choisy]")
End Function |
Partager