OVH Cloud OVH Cloud

Comment coder For each enregitrement de ma requête

6 réponses
Avatar
Laurent :\)
Bonjour j'ai la requ=EAte suivante:
SELECT DemChTech.NoDct, DemChTech.Secu,=20
PrioriteDCT.NSecurite, DemChTech.Design,=20
PrioriteDCT.NDesign, DemChTech.ReducCout,=20
PrioriteDCT.NReducCout, DemChTech.Service,=20
PrioriteDCT.NService, DemChTech.NewProd,=20
PrioriteDCT.NNouvProd, DemChTech.TotalPrio
FROM PrioriteDCT INNER JOIN DemChTech ON=20
PrioriteDCT.noauto =3D DemChTech.NoPrio;

J'aimerais dans cette requ=EAte faire en code:
For each enregitrement de ma requ=EAte
TotalPrio=3D 0
Case Secu.value =3D true
TotalPrio =3D TotalPrio + NSecurite
Case Design.value =3D true
TotalPrio =3D TotalPrio + NDesign
Case ReducCout.value =3D true
TotalPrio =3D TotalPrio + NReducCout
Case Service.value =3D true
TotalPrio =3D TotalPrio + NService
Case NewProd.value =3D true
TotalPrio =3D TotalPrio + NNouvProd
end Case
Find next


Merci de m'aider!

6 réponses

Avatar
John Fuss
dim cnn as new adodb.connection
dim rst as new adodb.recordset

set cnn = currentprojet.connection
rst.open "SELECT ......", cnn, adOpenStatic, adLockPessimistic
do until rst.eof
'ton traitement ici en utilisant rst.fields("NoDct").Value par exemple

rst.movenext
loop

John

oublie pas de référencer ADO !!! (microsoft activex data objects 2.1
Library)

"Laurent :)" a écrit dans le message
de news:15ece01c41e36$073a1210$
Bonjour j'ai la requête suivante:
SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio
FROM PrioriteDCT INNER JOIN DemChTech ON
PrioriteDCT.noauto = DemChTech.NoPrio;

J'aimerais dans cette requête faire en code:
For each enregitrement de ma requête
TotalPrio= 0
Case Secu.value = true
TotalPrio = TotalPrio + NSecurite
Case Design.value = true
TotalPrio = TotalPrio + NDesign
Case ReducCout.value = true
TotalPrio = TotalPrio + NReducCout
Case Service.value = true
TotalPrio = TotalPrio + NService
Case NewProd.value = true
TotalPrio = TotalPrio + NNouvProd
end Case
Find next


Merci de m'aider!
Avatar
Laurent:\)
Merci, j'essaie ça!
-----Message d'origine-----
dim cnn as new adodb.connection
dim rst as new adodb.recordset

set cnn = currentprojet.connection
rst.open "SELECT ......", cnn, adOpenStatic,
adLockPessimistic

do until rst.eof
'ton traitement ici en utilisant rst.fields
("NoDct").Value par exemple


rst.movenext
loop

John

oublie pas de référencer ADO !!! (microsoft activex data
objects 2.1

Library)

"Laurent :)" a
écrit dans le message

de news:15ece01c41e36$073a1210$
Bonjour j'ai la requête suivante:
SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio
FROM PrioriteDCT INNER JOIN DemChTech ON
PrioriteDCT.noauto = DemChTech.NoPrio;

J'aimerais dans cette requête faire en code:
For each enregitrement de ma requête
TotalPrio= 0
Case Secu.value = true
TotalPrio = TotalPrio + NSecurite
Case Design.value = true
TotalPrio = TotalPrio + NDesign
Case ReducCout.value = true
TotalPrio = TotalPrio + NReducCout
Case Service.value = true
TotalPrio = TotalPrio + NService
Case NewProd.value = true
TotalPrio = TotalPrio + NNouvProd
end Case
Find next


Merci de m'aider!



.



Avatar
Patatrac92
bonjour,

tu peux utiliser un test de ce genre


SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd,
IIf([Secu],[TotalPrio] + [NSecurite] ,IIf([Design],[TotalPrio] + [NDesign]
,IIf([Reduc],[TotalPrio] + [NReducCout] ,
IIf([Service],[TotalPrio] + [NService] ,IIf([NewProd ],[TotalPrio] +
[NNouvProd] ,[totalPrio])))))
.....
mais il existe peut être qqchose de + simple

"Laurent :)" a écrit dans le message
de news:15ece01c41e36$073a1210$
Bonjour j'ai la requête suivante:
SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio
FROM PrioriteDCT INNER JOIN DemChTech ON
PrioriteDCT.noauto = DemChTech.NoPrio;

J'aimerais dans cette requête faire en code:
For each enregitrement de ma requête
TotalPrio= 0
Case Secu.value = true
TotalPrio = TotalPrio + NSecurite
Case Design.value = true
TotalPrio = TotalPrio + NDesign
Case ReducCout.value = true
TotalPrio = TotalPrio + NReducCout
Case Service.value = true
TotalPrio = TotalPrio + NService
Case NewProd.value = true
TotalPrio = TotalPrio + NNouvProd
end Case
Find next


Merci de m'aider!
Avatar
ReBonjour! J'ai une erreure de syntaxe qui pointe sur la
ligne du INNER JOIN.
Je site exactement:
Erreur de syntaxe (opérateur abscent) dans
l'experession 'DemChTech.totalPrioFROM DemChtech INNER
JOIN PrioriteDCT ON DemChTech.Noprio = PrioriteDCT.noauto'

Voici ma requête:

rst.Open "SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio" & _

"FROM DemChTech" & _

"INNER JOIN PrioriteDCT ON DemChTech.NoPrio =
PrioriteDCT.noauto;", cnn, adOpenStatic, adLockPessimistic

Merci de m'aider!
Avatar
Eric
Bonjour

Il manque une espace devant le From
DemChTech.totalPrio FROM DemChtech INNER

A+
Eric

écrivait news:1a80f01c41e40$1e4e3a80
$:

ReBonjour! J'ai une erreure de syntaxe qui pointe sur la
ligne du INNER JOIN.
Je site exactement:
Erreur de syntaxe (opérateur abscent) dans
l'experession 'DemChTech.totalPrioFROM DemChtech INNER
JOIN PrioriteDCT ON DemChTech.Noprio = PrioriteDCT.noauto'

Voici ma requête:

rst.Open "SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio" & _

"FROM DemChTech" & _

"INNER JOIN PrioriteDCT ON DemChTech.NoPrio =
PrioriteDCT.noauto;", cnn, adOpenStatic, adLockPessimistic

Merci de m'aider!


Avatar
Eric
Re
il manque aussi un espace avant le Inner Join.
Derriere le Inner join c'est tout bon sous reserve que les champs NoPrio et
noAuto soit de meme nature.
A+
Eric

écrivait news:1a80f01c41e40$1e4e3a80
$:

ReBonjour! J'ai une erreure de syntaxe qui pointe sur la
ligne du INNER JOIN.
Je site exactement:
Erreur de syntaxe (opérateur abscent) dans
l'experession 'DemChTech.totalPrioFROM DemChtech INNER
JOIN PrioriteDCT ON DemChTech.Noprio = PrioriteDCT.noauto'

Voici ma requête:

rst.Open "SELECT DemChTech.NoDct, DemChTech.Secu,
PrioriteDCT.NSecurite, DemChTech.Design,
PrioriteDCT.NDesign, DemChTech.ReducCout,
PrioriteDCT.NReducCout, DemChTech.Service,
PrioriteDCT.NService, DemChTech.NewProd,
PrioriteDCT.NNouvProd, DemChTech.TotalPrio" & _

"FROM DemChTech" & _

"INNER JOIN PrioriteDCT ON DemChTech.NoPrio =
PrioriteDCT.noauto;", cnn, adOpenStatic, adLockPessimistic

Merci de m'aider!