IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Access Discussion :

Mise à jour globale de plusieurs champs d'une table selon une référence


Sujet :

Access

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Mai 2010
    Messages
    1
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Mise à jour globale de plusieurs champs d'une table selon une référence
    Bonjour,

    j'utilise une table temporaire pour afficher des information selon le personnel sélection mais mon code ne marche pas très. j'ai comme message d'erreur : "Champ memo, OLE ou hyperlink ncorrect dans la sous requête "NOM_PERSONNEL"

    Voici: le code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    CurrentDb.Execute ("Insert Into TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING  select * from TAB_PERSONNEL_ASSOCIEAUPLANNING where RefPlanningAssocie='" & Me.RefPlanningMod & "'")
    CurrentDb.Execute ("Insert into TMP_TAB_PERSONNEL (RefPlanning, NUMMAT_PERSONNEL) select RefPlanningAssocie, RefBadgePersonnelPlanningAssocie from TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set NOM_PERSONNEL = (select NOM_PERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set PRENOM_PERSONNEL = (select PRENOM_PERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set NUMPROTABLE_PERSONNEL = (select NUMPROTABLE_PERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set ADRESSE_PERSONNEL = (select ADRESSE_PERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set CODEBARRE_MATRICULEPERSONNEL = (select CODEBARRE_MATRICULEPERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set ConfirmationPrsnl = (select ConfirmationPrsnl from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    Me.Requery
    merci

  2. #2
    Expert éminent

    Homme Profil pro
    Inscrit en
    Mai 2012
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Madagascar

    Informations forums :
    Inscription : Mai 2012
    Messages : 3 840
    Points : 7 974
    Points
    7 974
    Par défaut
    Bonjour,

    Peux-tu mettre ton code dans les balises correspondantes parec que ce n'est pas évident de le lire.
    Pour cela : ==>Tu le sélectionnes et tu cliques sur #.

    A priori, d'après ce que je comprends, tu as une erreur lors de l'exécution de la requête :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    CurrentDb.Execute ("Update TMP_TAB_PERSONNEL set NOM_PERSONNEL = (select NOM_PERSONNEL from TAB_PERSONNEL where TAB_PERSONNEL.NUMMAT_PERSONNEL=TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefBadgePersonnelPlanningAssocie and TMP_TAB_PERSONNEL_ASSOCIEAUPLANNING.RefPlanning= '" & Me.RefPlanningMod & "')")
    Si tu es sûr que ta sous-requête ne renvoie qu'une seule valeur, je crois bien que tu as oublié de mettre le résultat entre quotes.

    Cordialement,
    Mandresy
    "Je ne sais qu'une chose, c'est que je ne sais rien" Socrate

    N'oublions pas de mettre quand on a trouvé notre bonheur. Soyons sympa pour les futurs heureux.

    Merci, c'est toujours sympa de recevoir des de votre part

Discussions similaires

  1. [MySQL] Affichage, mise à jour et insertion d'enregistrement d'une table
    Par fabone dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 09/03/2015, 19h01
  2. Mise à jour de tous les enregistrements d'une table
    Par beekeep dans le forum Langage SQL
    Réponses: 2
    Dernier message: 17/10/2010, 12h57
  3. [AC-2000] Mise à jour automatique d'un champ dans une table
    Par Nerva dans le forum Access
    Réponses: 3
    Dernier message: 14/10/2010, 18h49
  4. Réponses: 2
    Dernier message: 05/07/2010, 15h19
  5. Réponses: 2
    Dernier message: 08/08/2007, 15h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo