Requête SQL incorrecte!

js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 - 24 oct. 2009 à 00:37
js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 - 25 oct. 2009 à 00:03
Bonjour,

j'ai un problème avec ma requête SQL ci-dessous :


connect

cn.Execute " INSERT INTO tableimpdossier " _
& " select tabledossier.numdossier, tabledossier.datedossier, tabledossier.resultat, tabledossier.commentaire, tabledossier.medecintraitant, " & _
" tableexamen.nomexamen, tablenature.desnature, tablepropriete.nompropriete, tablepatient.numpatient, tablepatient.nompatient, tablepatient.prenompatient, " & _
" tablepatient.sexepatient, tablepatient.contactpatient, tablevaleur.valpatient, tablevaleur.valnormale, tablevaleur.interpretation " & _
" From tabledossier, tableexamen, tablenature, tablepropriete, tablepatient, tablevaleur " & _
" where tabledossier.numexamen = tableexamen.numexamen, & " _
" tableexamen.numnature = tablenature.numnature, & " _
" tabledossier.numpatient = tablepatient.numpatient, " & _
" tablevaleur.numpropriete = tablepropriete.numpropriete " & _
" and tablevaleur.numdossier = " & txtnumdossier & " "



Quelqu'un pourrait-il m'aider s'il vous plaît?

Merci d'avance.

Cordialement.

4 réponses

js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 2
24 oct. 2009 à 00:37
Désolé mais je ne sais pas comment arranger ça pour que vous voyiez mieux
0
js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 2
24 oct. 2009 à 00:45
J'ai pu "résoudre" quelques petits problèmes. Mais on me parle d'erreur de syntaxe (virgule) pour le code qui suit :


cn.Execute " INSERT INTO tableimpdossier " _
& " select tabledossier.numdossier, tabledossier.datedossier, tabledossier.resultat, tabledossier.commentaire, tabledossier.medecintraitant, " & _
" tableexamen.nomexamen, tablenature.desnature, tablepropriete.nompropriete, tablepatient.numpatient, tablepatient.nompatient, tablepatient.prenompatient, " & _
" tablepatient.sexepatient, tablepatient.contactpatient, tablevaleur.valpatient, tablevaleur.valnormale, tablevaleur.interpretation " & _
" From tabledossier, tableexamen, tablenature, tablepropriete, tablepatient, tablevaleur " & _
" Where tabledossier.numexamen = tableexamen.numexamen, " & _
" tableexamen.numnature = tablenature.numnature, " & _
" tabledossier.numpatient = tablepatient.numpatient, " & _
" tablevaleur.numpropriete tablepropriete.numpropriete And tablevaleur.numdossier " & txtnumdossier & " "


Merci d'avance pour votre très précieuse aide.

Cordialement.
0
cboulas Messages postés 2641 Date d'inscription mercredi 2 juin 2004 Statut Membre Dernière intervention 8 janvier 2014 16
24 oct. 2009 à 09:31
Hello,

les virgules ne sont pas autorisée dans les wheres (enfin pas partout)
Remplace les par des AND, OR, ou fait des inner join, left join...

Chris
0
js8bleu Messages postés 576 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 27 janvier 2014 2
25 oct. 2009 à 00:03
Bonjour et Merci cboulas pour ton intervention. En effet la requête suivante donne :


INSERT INTO tableimpdossier
select D.numdossier AS NumDossier
, D.datedossier AS DateDossier
, D.resultat AS Resultat
, D.commentaire AS Commentaire
, D.medecintraitant AS MedecinTraitant
, E.nomexamen AS NomExamen
, N.desnature AS DesNature
, PR.nompropriete AS NomPropriete
, D.numpatient AS NumPatient
, PA.nompatient AS NomPatient
, PA.prenompatient AS PrenomPatient
, PA.sexepatient AS Sexe
, PA.contactpatient AS ContactPatient
, V.valpatient AS ValPatient
, V.valnormale AS ValNormale
, V.interpretation AS Interpretation
From tabledossier D
, tableexamen E
, tablenature N
, tablepropriete PR
, tablepatient PA
, tablevaleur V
Where D.numexamen = E.numexamen
AND E.numnature = N.numnature
AND D.numpatient = PA.numpatient
AND D.numdossier = V.numdossier
AND V.numpropriete = PR.numpropriete
AND V.numdossier = " & txtnumdossier & " "


mais je ne sais pas pourquoi il m'affiche une erreur (pour D.numpatient AS NumPatient) comme quoi le champ est inconnu pour il existe bien sous ce nom dans la table tabledossier. Savez-vous pourquoi?

Merci d'avance.

Cordialement.
0
Rejoignez-nous