A -cree une table
B -cree une requete croisée
C -ajout la requete croisée dans la table cree par A
la troisieme requete ne trouve pas la deuxieme ???
il faut actualisé entre B et C ???
il me manque un truc, non??
..j'ai pas trouvé dans le newsgroup, je dois manqué de vocabulaire !!!!
Function TabMarge()
On Error GoTo TabMarge_Err
Dim bds As Database, req As QueryDef
Dim txt, dum As String
Set bds = CurrentDb
dum = ""
DoCmd.SetWarnings False
' A cree TabMarge
txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE,
Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER
JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY
ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH
OWNERACCESS OPTION;"
DoCmd.RunSQL txt
' B TabMargeX
txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1
Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1
Produit].[N°assolement], 'rdt' PIVOT 'cout';"
Set req = bds.CreateQueryDef("TabMargeX", txt)
' C TabMargeAjout
txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT
TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;"
DoCmd.RunSQL txt
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
3stone
Salut,
"dumgest" [...] | ' A cree TabMarge | txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE, | Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER | JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY | ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH | OWNERACCESS OPTION;" | DoCmd.RunSQL txt | | ' B TabMargeX | txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1 | Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1 | Produit].[N°assolement], 'rdt' PIVOT 'cout';" | Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout | txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT | TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;" | DoCmd.RunSQL txt
"dumgest"
[...]
| ' A cree TabMarge
| txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE,
| Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER
| JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY
| ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH
| OWNERACCESS OPTION;"
| DoCmd.RunSQL txt
|
| ' B TabMargeX
| txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1
| Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1
| Produit].[N°assolement], 'rdt' PIVOT 'cout';"
| Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout
| txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT
| TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;"
| DoCmd.RunSQL txt
"dumgest" [...] | ' A cree TabMarge | txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE, | Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER | JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY | ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH | OWNERACCESS OPTION;" | DoCmd.RunSQL txt | | ' B TabMargeX | txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1 | Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1 | Produit].[N°assolement], 'rdt' PIVOT 'cout';" | Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout | txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT | TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;" | DoCmd.RunSQL txt
grand merçi à toi 3stone de ce petit refresh..issement de memoire
je suppose que cela fonctionne aussi avec dbs.Tabledefs.refresh...aussi dbs.Querydefs.refresh...oui celui là, ok mais pas cela ?? dbs.Formdefs.refresh dbs.Reportdefs.refresh
Bravo pour ton site Web egalement,..... j'y retourne !!
@+
Rémi Dumery
"3stone" a écrit dans le message de news: %
Salut,
"dumgest" [...] | ' A cree TabMarge | txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE, | Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER | JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY | ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH | OWNERACCESS OPTION;" | DoCmd.RunSQL txt | | ' B TabMargeX | txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1 | Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1 | Produit].[N°assolement], 'rdt' PIVOT 'cout';" | Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout | txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT | TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;" | DoCmd.RunSQL txt
grand merçi à toi 3stone de ce petit refresh..issement de memoire
je suppose que cela fonctionne aussi avec
dbs.Tabledefs.refresh...aussi
dbs.Querydefs.refresh...oui celui là, ok
mais pas cela ??
dbs.Formdefs.refresh
dbs.Reportdefs.refresh
Bravo pour ton site Web egalement,..... j'y retourne !!
@+
Rémi Dumery
"3stone" <3stone_@_skynet_be> a écrit dans le message de news:
%23O7elAAOGHA.2696@TK2MSFTNGP14.phx.gbl...
Salut,
"dumgest"
[...]
| ' A cree TabMarge
| txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE,
| Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE
INNER
| JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP
BY
| ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH
| OWNERACCESS OPTION;"
| DoCmd.RunSQL txt
|
| ' B TabMargeX
| txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1
| Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY
[Req1
| Produit].[N°assolement], 'rdt' PIVOT 'cout';"
| Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout
| txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT
| TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM
TabMargeX;"
| DoCmd.RunSQL txt
grand merçi à toi 3stone de ce petit refresh..issement de memoire
je suppose que cela fonctionne aussi avec dbs.Tabledefs.refresh...aussi dbs.Querydefs.refresh...oui celui là, ok mais pas cela ?? dbs.Formdefs.refresh dbs.Reportdefs.refresh
Bravo pour ton site Web egalement,..... j'y retourne !!
@+
Rémi Dumery
"3stone" a écrit dans le message de news: %
Salut,
"dumgest" [...] | ' A cree TabMarge | txt = "SELECT DISTINCTROW ITKE.[N°assolement], ITKE.TYPE, | Sum([DOSE]*[prix]*[Surf]/[SURFACE]) AS cout INTO TabMarge FROM ITKE INNER | JOIN Assolement ON ITKE.[N°assolement] = Assolement.[N°assolement]GROUP BY | ITKE.[N°assolement], ITKE.TYPE HAVING (((ITKE.TYPE) Is Not Null))WITH | OWNERACCESS OPTION;" | DoCmd.RunSQL txt | | ' B TabMargeX | txt = "TRANSFORM Sum([Req1 Produit].rdt) AS SommeDerdt SELECT [Req1 | Produit].[N°assolement], 'rdt' AS Type FROM [Req1 Produit] GROUP BY [Req1 | Produit].[N°assolement], 'rdt' PIVOT 'cout';" | Set req = bds.CreateQueryDef("TabMargeX", txt)
dbs.Querydefs.refresh
| ' C TabMargeAjout | txt = "INSERT INTO TabMarge ( [N°assolement], TYPE, cout )SELECT | TabMargeX.[N°assolement], TabMargeX.Type, TabMargeX.cout FROM TabMargeX;" | DoCmd.RunSQL txt