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

IHM Discussion :

Limitation Zone de liste déroulante.


Sujet :

IHM

  1. #1
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut Limitation Zone de liste déroulante.
    Bonjour à Tous,

    Je souhaite ajouter des données dans un formulaire qui contient 8 sous formulaires et chacun alimente une table.
    Ces sous formulaires contiennent tous des contrôles indépendants.
    J’ai donc fait comme d’habitude à savoir une requête qui va récupérer toutes les données des 8 tables pour alimenter ma liste déroulante.
    Seul souci ma requête contient 112 champs et la liste déroulante est limitée à 20 champs ☹

    Est-ce qu’il existe une alternative ?

    Je souhaiterai faire quelque chose de similaire au code ci-dessous pour alimenter mes contrôles.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Private Sub lst_select_ML_AfterUpdate() ' Pour création de la fiche ML
    'déclaration variables afin que les champs récupèrent leurs éléments à la sélection du nom la colonne correspond à leur position dans la liste
     
    txt_civ = lst_select_ML.Column(2)
    txt_nom = lst_select_ML.Column(0)
    txt_prenom = lst_select_ML.Column(1)
    txt_matricule = lst_select_ML.Column(3)
    txt_sigle = lst_select_ML.Column(5)
    txt_mail = lst_select_ML.Column(6)
    txt_statut_pops = lst_select_ML.Column(7)
    txt_igg = lst_select_ML.Column(8)
    txt_immeuble = lst_select_ML.Column(9)
     
    End Sub

    Et faire en sorte que l’opérateur puisse choisir dans une liste de noms pour faire sa tache.

    Je vous remercie pour votre aide

  2. #2
    Expert confirmé
    Homme Profil pro
    retraité
    Inscrit en
    Juin 2012
    Messages
    3 183
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : retraité
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juin 2012
    Messages : 3 183
    Points : 5 515
    Points
    5 515
    Par défaut
    Bonjour,

    Pour autant que j'aie bien compris le problème posé, cela pourrait se faire en utilisant le recordset filtré de la requête aux 112 champs. Quelque chose du genre:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        Set Db = CurrentDb
        Set Rst = Db.openrecordset(sSQL, dbOpenSnapshot)
        Me.txt_nom= Rst.fields(0)
        Me.txt_prenom= Rst.fields(1)
    Un petit exemple en attaché.
    Cordialement.
    Fichiers attachés Fichiers attachés

  3. #3
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    merci EricDgn,

    Je vais regarder cela dans la semaine.

    Belle soirée

  4. #4
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Bonjour à Tous,

    J'ai regardé mais ça ne convient pas.
    Du coup je passe par une liste déroulante réduite (id,nom,prenom et service)
    c'est sur cette liste déroulante que j'alimente ma requete qui contient les 112 champs (ci-dessous)
    Code SQL : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    SELECT T_ML.id_ML, T_ML.date_saisie, T_ML.nom, T_ML.prenom, T_ML.matricule, T_ML.civ, T_ML.igg, T_ML.site, T_ML.sigle, T_ML.statut_pops, T_ML.mail_collaborateur, T_ML.date_mail_HRCO, T_ML.statut_notif_HRCO, T_ML.date_effet, T_ML.date_depart_physic, T_ML.type_mouvement, T_ML.garden_leave, T_ML.checklist, T_ML.departement_depart, T_ML.code_emploi_depart, T_ML.nom_manager_depart, T_ML.mail_manager_depart, T_ML.departement_arrive, T_ML.code_emploi_arrive, T_ML.nom_manager_arrive, T_ML.mail_manager_arrive, T_ML.mailbox_perimetre, T_ML.statut_ML, T_ML.commentaires_ML, T_ML.flag_checklist_PDF, T_ML.date_relance_CAF, T_ML.date_relance_H24, T_ML.date_relance_NDF, T_ML.date_relance_asset, T_ML.date_relance_RLM, T_ML.matricule_user_ML, T_CAF.id_CAF, T_CAF.possede_CAF, T_CAF.num_carte, T_CAF.echeance_CAF, T_CAF.statut_CAF, T_CAF.nom_porteur, T_CAF.ref_contrat, T_CAF.num_prestation, T_CAF.etat_lieux_CRE, T_CAF.date_etat_lieux_CRE, T_CAF.decision_manager_CAF, T_CAF.date_decision_manager_CAF, T_CAF.commentaires_CAF, T_CAF.flag_check_CAF, T_CAF.matricule_user_CAF, T_H24.id_H24, T_H24.access_H24, T_H24.date_eport_adah, T_H24.H24_BASALTE_existant, T_H24.H24_CONEX_existant, T_H24.H24_DUNES_existant, T_H24.H24_HAUSSMANN_existant, T_H24.H24_PACIFIC_existant, T_H24.H24_PERIVAL_existant, T_H24.H24_PERSPECTIVE_existant, T_H24.H24_TAC_existant, T_H24.date_mail_existant, T_H24.H24_BASALTE_decision, T_H24.H24_CONEX_decision, T_H24.H24_DUNES_decision, T_H24.H24_HAUSSMANN_decision, T_H24.H24_PACIFIC_decision, T_H24.H24_PERIVAL_decision, T_H24.H24_PERSPECTIVE_decision, T_H24.H24_TAC_decision, T_H24.date_mail_reponse_CRE, T_H24.date_maj_adah, T_H24.commentaires_H24, T_H24.flag_check_H24, T_H24.matricule_user_H24, T_NDF.id_NDF, T_NDF.date_mail_NDF, T_NDF.etat_lieux_NDF, T_NDF.commentaires_NDF, T_NDF.flag_check_NDF, T_NDF.matricule_user_NDF, T_PM.id_PM, T_PM.date_mail_PM, T_PM.etat_lieux_PM, T_PM.commentaires_PM, T_PM.flag_check_PM, T_PM.matricule_user_PM, T_A7.id_A7, T_A7.date_mail_GTS, T_A7.etat_lieux_A7, T_A7.date_reponse_manager_A7, T_A7.decision_manager_A7, T_A7.date_relance_de_GTS, T_A7.commentaires_A7, T_A7.flag_check_A7, T_A7.matricule_user_A7, T_MKD.id_MKD, T_MKD.date_mail_MKD, T_MKD.etat_lieux_MKD, T_MKD.commentaires_MKD, T_MKD.flag_check_MKD, T_MKD.matricule_user_MKD, T_RLM.id_RLM, T_RLM.date_mail_adah, T_RLM.retour_adah_RLM, T_RLM.commentaires_adah, T_RLM.date_mail_atlas, T_RLM.retour_atlas_RLM, T_RLM.commentaires_atlas, T_RLM.flag_check_RLM, T_RLM.matricule_user_RLM
    FROM ((((((T_ML INNER JOIN T_A7 ON T_ML.id_ML = T_A7.id_ML) INNER JOIN T_CAF ON T_ML.id_ML = T_CAF.id_ML) INNER JOIN T_H24 ON T_ML.id_ML = T_H24.id_ML) INNER JOIN T_MKD ON T_ML.id_ML = T_MKD.id_ML) INNER JOIN T_NDF ON T_ML.id_ML = T_NDF.id_ML) INNER JOIN T_PM ON T_ML.id_ML = T_PM.id_ML) INNER JOIN T_RLM ON T_ML.id_ML = T_RLM.id_ML
    WHERE (((T_ML.id_ML) Like "*" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)]));

    La condition Where fait référence à l'ID de la personne sélectionnée dans la liste.

    Maintenant je ne sais pas comment assigner chaque champ à chaque contrôle

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    txt_nom = ?
    txt_prenom = ?
    txt_matricule =? 
    txt_sigle = ?
    ETC...
    Merci pour votre aide

  5. #5
    Expert confirmé
    Homme Profil pro
    retraité
    Inscrit en
    Juin 2012
    Messages
    3 183
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : retraité
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juin 2012
    Messages : 3 183
    Points : 5 515
    Points
    5 515
    Par défaut
    Que donne ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
        Dim db As dao.Database
        Dim Rst As dao.Recordset
        Dim sSQL As String
    sSQL = "SELECT T_ML.id_ML, T_ML.date_saisie, T_ML.nom, T_ML.prenom, T_ML.matricule, T_ML.civ, T_ML.igg, T_ML.site, T_ML.sigle, T_ML.statut_pops, T_ML.mail_collaborateur, T_ML.date_mail_HRCO, T_ML.statut_notif_HRCO, T_ML.date_effet, T_ML.date_depart_physic, T_ML.type_mouvement, T_ML.garden_leave, T_ML.checklist, T_ML.departement_depart, T_ML.code_emploi_depart, T_ML.nom_manager_depart, T_ML.mail_manager_depart, T_ML.departement_arrive, T_ML.code_emploi_arrive, T_ML.nom_manager_arrive, T_ML.mail_manager_arrive, T_ML.mailbox_perimetre, T_ML.statut_ML, T_ML.commentaires_ML, T_ML.flag_checklist_PDF, T_ML.date_relance_CAF, T_ML.date_relance_H24, T_ML.date_relance_NDF, T_ML.date_relance_asset, T_ML.date_relance_RLM, T_ML.matricule_user_ML, T_CAF.id_CAF, T_CAF.possede_CAF, T_CAF.num_carte, T_CAF.echeance_CAF, T_CAF.statut_CAF, T_CAF.nom_porteur, T_CAF.ref_contrat, T_CAF.num_prestation, T_CAF.etat_lieux_CRE, T_CAF.date_etat_lieux_CRE, T_CAF.decision_manager_CAF, T_CAF.date_decision_manager_CAF, T_CAF.commentaires_CAF, T_CAF.
    flag_check_CAF , T_CAF.matricule_user_CAF, T_H24.id_H24, T_H24.access_H24, T_H24.date_eport_adah, T_H24.H24_BASALTE_existant, T_H24.H24_CONEX_existant, T_H24.H24_DUNES_existant, T_H24.H24_HAUSSMANN_existant, T_H24.H24_PACIFIC_existant, T_H24.H24_PERIVAL_existant, T_H24.H24_PERSPECTIVE_existant, T_H24.H24_TAC_existant, T_H24.date_mail_existant, T_H24.H24_BASALTE_decision, T_H24.H24_CONEX_decision, T_H24.H24_DUNES_decision, T_H24.H24_HAUSSMANN_decision, T_H24.H24_PACIFIC_decision, T_H24.H24_PERIVAL_decision, T_H24.H24_PERSPECTIVE_decision, T_H24.H24_TAC_decision, T_H24.date_mail_reponse_CRE, T_H24.date_maj_adah, T_H24.commentaires_H24, T_H24.flag_check_H24, T_H24.matricule_user_H24, T_NDF.id_NDF, T_NDF.date_mail_NDF, T_NDF.etat_lieux_NDF, T_NDF.commentaires_NDF, T_NDF.flag_check_NDF, T_NDF.matricule_user_NDF, T_PM.id_PM, T_PM.date_mail_PM, T_PM.etat_lieux_PM, T_PM.commentaires_PM, T_PM.flag_check_PM, T_PM.matricule_user_PM, T_A7.id_A7, T_A7.date_mail_GTS, T_A7.etat_lieux_A7, T_A7.date_reponse_manager_A7, T_A7.
    ecision_manager_A7 , T_A7.date_relance_de_GTS, T_A7.commentaires_A7, T_A7.flag_check_A7, T_A7.matricule_user_A7, T_MKD.id_MKD, T_MKD.date_mail_MKD, T_MKD.etat_lieux_MKD, T_MKD.commentaires_MKD, T_MKD.flag_check_MKD, T_MKD.matricule_user_MKD, T_RLM.id_RLM, T_RLM.date_mail_adah, T_RLM.retour_adah_RLM, T_RLM.commentaires_adah, T_RLM.date_mail_atlas, T_RLM.retour_atlas_RLM, T_RLM.commentaires_atlas, T_RLM.flag_check_RLM, T_RLM.matricule_user_RLM
    FROM ((((((T_ML INNER JOIN T_A7 ON T_ML.id_ML = T_A7.id_ML) INNER JOIN T_CAF ON T_ML.id_ML = T_CAF.id_ML) INNER JOIN T_H24 ON T_ML.id_ML = T_H24.id_ML) INNER JOIN T_MKD ON T_ML.id_ML = T_MKD.id_ML) INNER JOIN T_NDF ON T_ML.id_ML = T_NDF.id_ML) INNER JOIN T_PM ON T_ML.id_ML = T_PM.id_ML) INNER JOIN T_RLM ON T_ML.id_ML = T_RLM.id_ML
    WHERE (((T_ML.id_ML)=" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)] & "));"
    '--- ou WHERE T_ML.id_ML="& Me.lst_selct_fiche_ML_1 & ";"
        Set db = CurrentDb
        Set Rst = db.openrecordset(sSQL, dbOpenSnapshot)
        Me.txt_nom= Rst.fields(1)
        Me.txt_prenom= Rst.fields(2)
        Rst.Close
    Cordialement.

  6. #6
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    merci EricDgn,

    Je n'ai pas encore alimenté mes tables pour procéder aux tests mais vais m'y atteler j'ai encore d'autres codes à préparer.

    Si je comprends bien, "Rst.fields(1)" correspond au premier champ de la requête, cela fonctionne comme une liste déroulante en partant de 0

  7. #7
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Bonjour à tous,

    je reviens après congés et reprend le cours de ma tache.
    Je viens de terminer la codification sur mon formulaire mais elle ne passe pas
    Ca bloque au niveau de la requete, compilation incorrect



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    Option Compare Database
    Option Explicit
     
    Private Sub but_suivi_fiche_Click() 'ouverture du formulaire Sélection Fiche ML
     
        Dim db As dao.Database
        Dim Rst As dao.Recordset
        Dim sSQL As String
     
        DoCmd.OpenForm "F_fond"
     
        ' Se positionne sur un champs non masqué
        [Forms]![F_fond].txt_date_jour.SetFocus
     
        ' affiche les champs non nécessaire à ce formulaire
        [Forms]![F_fond].etiq_titre_suivi_ML.Visible = True
        [Forms]![F_fond].etiq_fiche_de.Visible = True
        [Forms]![F_fond].txt_fiche_de_nom.Visible = True
     
        ' masquer les champs non nécessaire à ce formulaire
        [Forms]![F_fond].etiq_titre_crea_ML.Visible = False
        [Forms]![F_fond].but_refresh_forms.Visible = False
        [Forms]![F_fond].etiq_refresh.Visible = False
     
        sSQL = "SELECT T_ML.id_ML, T_ML.date_saisie, T_ML.nom, T_ML.prenom, T_ML.matricule, T_ML.civ, T_ML.igg, T_ML.site, T_ML.sigle, T_ML.statut_pops, T_ML.mail_collaborateur, T_ML.date_mail_HRCO, T_ML.statut_notif_HRCO, T_ML.date_effet, T_ML.date_depart_physic, T_ML.type_mouvement, T_ML.garden_leave, T_ML.checklist, T_ML.departement_depart, T_ML.code_emploi_depart, T_ML.nom_manager_depart, T_ML.mail_manager_depart, T_ML.departement_arrive, T_ML.code_emploi_arrive, T_ML.nom_manager_arrive, T_ML.mail_manager_arrive, T_ML.mailbox_perimetre, T_ML.statut_ML, T_ML.commentaires_ML, T_ML.flag_checklist_PDF, T_ML.date_relance_CAF, T_ML.date_relance_H24, T_ML.date_relance_NDF, T_ML.date_relance_asset, T_ML.date_relance_RLM, T_ML.matricule_user_ML, T_CAF.id_CAF, T_CAF.possede_CAF, T_CAF.num_carte, T_CAF.echeance_CAF, T_CAF.statut_CAF, T_CAF.nom_porteur, T_CAF.ref_contrat, T_CAF.num_prestation, T_CAF.etat_lieux_CRE, T_CAF.date_etat_lieux_CRE, T_CAF.decision_manager_CAF, T_CAF.date_decision_manager_CAF, T_CAF.commentaires
    _CAF, T_CAF.
        flag_check_CAF , T_CAF.matricule_user_CAF, T_H24.id_H24, T_H24.access_H24, T_H24.date_eport_adah, T_H24.H24_BASALTE_existant, T_H24.H24_CONEX_existant, T_H24.H24_DUNES_existant, T_H24.H24_HAUSSMANN_existant, T_H24.H24_PACIFIC_existant, T_H24.H24_PERIVAL_existant, T_H24.H24_PERSPECTIVE_existant, T_H24.H24_TAC_existant, T_H24.date_mail_existant, T_H24.H24_BASALTE_decision, T_H24.H24_CONEX_decision, T_H24.H24_DUNES_decision, T_H24.H24_HAUSSMANN_decision, T_H24.H24_PACIFIC_decision, T_H24.H24_PERIVAL_decision, T_H24.H24_PERSPECTIVE_decision, T_H24.H24_TAC_decision, T_H24.date_mail_reponse_CRE, T_H24.date_maj_adah, T_H24.commentaires_H24, T_H24.flag_check_H24, T_H24.matricule_user_H24, T_NDF.id_NDF, T_NDF.date_mail_NDF, T_NDF.etat_lieux_NDF, T_NDF.commentaires_NDF, T_NDF.flag_check_NDF, T_NDF.matricule_user_NDF, T_PM.id_PM, T_PM.date_mail_PM, T_PM.etat_lieux_PM, T_PM.commentaires_PM, T_PM.flag_check_PM, T_PM.matricule_user_PM, T_A7.id_A7, T_A7.date_mail_GTS, T_A7.etat_lieux_A7, T_A7.date_reponse_manager_A7,
        T_A7.decision_manager_A7 , T_A7.date_relance_de_GTS, T_A7.commentaires_A7, T_A7.flag_check_A7, T_A7.matricule_user_A7, T_MKD.id_MKD, T_MKD.date_mail_MKD, T_MKD.etat_lieux_MKD, T_MKD.commentaires_MKD, T_MKD.flag_check_MKD, T_MKD.matricule_user_MKD, T_RLM.id_RLM, T_RLM.date_mail_adah, T_RLM.retour_adah_RLM, T_RLM.commentaires_adah, T_RLM.date_mail_atlas, T_RLM.retour_atlas_RLM, T_RLM.commentaires_atlas, T_RLM.flag_check_RLM, T_RLM.matricule_user_RLM
        FROM ((((((T_ML INNER JOIN T_A7 ON T_ML.id_ML = T_A7.id_ML) INNER JOIN T_CAF ON T_ML.id_ML = T_CAF.id_ML) INNER JOIN T_H24 ON T_ML.id_ML = T_H24.id_ML) INNER JOIN T_MKD ON T_ML.id_ML = T_MKD.id_ML) INNER JOIN T_NDF ON T_ML.id_ML = T_NDF.id_ML) INNER JOIN T_PM ON T_ML.id_ML = T_PM.id_ML) INNER JOIN T_RLM ON T_ML.id_ML = T_RLM.id_ML
        WHERE (((T_ML.id_ML)=" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)] & "));"
     
     
     
        Set db = CurrentDb
        Set Rst = db.OpenRecordset(sSQL, dbOpenSnapshot)
        Forms![F_fond].Form![SF_ML]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_ML]!txt_date_saisie.Value = Rst.Fields(1)
        Forms![F_fond].Form![SF_ML]!txt_nom.Value = Rst.Fields(2)
        Forms![F_fond].Form![SF_ML]!txt_prenom.Value = Rst.Fields(3)
        Forms![F_fond].Form![SF_ML]!txt_matricule.Value = Rst.Fields(4)
        Forms![F_fond].Form![SF_ML]!txt_civ.Value = Rst.Fields(5)
        Forms![F_fond].Form![SF_ML]!txt_igg.Value = Rst.Fields(6)
        Forms![F_fond].Form![SF_ML]!txt_immeuble.Value = Rst.Fields(7)
        Forms![F_fond].Form![SF_ML]!txt_sigle.Value = Rst.Fields(8)
        Forms![F_fond].Form![SF_ML]!txt_statut_pops.Value = Rst.Fields(9)
        Forms![F_fond].Form![SF_ML]!txt_mail.Value = Rst.Fields(10)
        Forms![F_fond].Form![SF_ML]!txt_date_hrco.Value = Rst.Fields(11)
        Forms![F_fond].Form![SF_ML]!txt_statut_notif.Value = Rst.Fields(12)
        Forms![F_fond].Form![SF_ML]!txt_date_effet.Value = Rst.Fields(13)
        Forms![F_fond].Form![SF_ML]!txt_date_dep_phy.Value = Rst.Fields(14)
        Forms![F_fond].Form![SF_ML]!lst_type_mouv.Value = Rst.Fields(15)
        Forms![F_fond].Form![SF_ML]!coche_garden.Value = Rst.Fields(16)
        Forms![F_fond].Form![SF_ML]!txt_checklist.Value = Rst.Fields(17)
        Forms![F_fond].Form![SF_ML]!txt_sigl_depart.Value = Rst.Fields(18)
        Forms![F_fond].Form![SF_ML]!txt_code_e_depart.Value = Rst.Fields(19)
        Forms![F_fond].Form![SF_ML]!txt_manag_depart.Value = Rst.Fields(20)
        Forms![F_fond].Form![SF_ML]!txt_mail_manag_dep.Value = Rst.Fields(21)
        Forms![F_fond].Form![SF_ML]!txt_sigle_arrivee.Value = Rst.Fields(22)
        Forms![F_fond].Form![SF_ML]!txt_code_e_arrivee.Value = Rst.Fields(23)
        Forms![F_fond].Form![SF_ML]!txt_manag_arrivee.Value = Rst.Fields(24)
        Forms![F_fond].Form![SF_ML]!txt_mail_manag_arrivee.Value = Rst.Fields(25)
        Forms![F_fond].Form![SF_ML]!txt_mailbox_perimetre.Value = Rst.Fields(26)
        Forms![F_fond].Form![SF_ML]!txt_mailbox_perimetre_arrive.Value = Rst.Fields(27)
        Forms![F_fond].Form![SF_ML]!lst_statut_ML.Value = Rst.Fields(28)
        Forms![F_fond].Form![SF_ML]!txt_commentaires.Value = Rst.Fields(29)
        Forms![F_fond].Form![SF_ML]!txt_date_rel_CAF.Value = Rst.Fields(30)
        Forms![F_fond].Form![SF_ML]!txt_date_rel_H24.Value = Rst.Fields(31)
        Forms![F_fond].Form![SF_ML]!txt_date_rel_NDF.Value = Rst.Fields(32)
        Forms![F_fond].Form![SF_ML]!txt_date_rel_A7.Value = Rst.Fields(33)
        Forms![F_fond].Form![SF_ML]!txt_date_rel_RLM.Value = Rst.Fields(34)
        Forms![F_fond].Form![SF_ML]!txt_matricule_user_ML.Value = Rst.Fields(35)
     
        Forms![F_fond].Form![SF_CAF]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_CAF]!txt_id_CAF.Value = Rst.Fields(36)
        Forms![F_fond].Form![SF_CAF]!grop_possede_CAF.Value = Rst.Fields(37)
        Forms![F_fond].Form![SF_CAF]!txt_num_CAF.Value = Rst.Fields(38)
        Forms![F_fond].Form![SF_CAF]!txt_echeance_CAF.Value = Rst.Fields(39)
        Forms![F_fond].Form![SF_CAF]!txt_statut_CAF.Value = Rst.Fields(40)
        Forms![F_fond].Form![SF_CAF]!txt_porteur_CAF.Value = Rst.Fields(41)
        Forms![F_fond].Form![SF_CAF]!txt_ref_contrat.Value = Rst.Fields(42)
        Forms![F_fond].Form![SF_CAF]!txt_num_prestation.Value = Rst.Fields(43)
        Forms![F_fond].Form![SF_CAF]!grop_etat_lieux.Value = Rst.Fields(44)
        Forms![F_fond].Form![SF_CAF]!txt_date_mail_CRE.Value = Rst.Fields(45)
        Forms![F_fond].Form![SF_CAF]!grop_decision.Value = Rst.Fields(46)
        Forms![F_fond].Form![SF_CAF]!txt_date_mail_manager.Value = Rst.Fields(47)
        Forms![F_fond].Form![SF_CAF]!txt_commentaires_CAF.Value = Rst.Fields(48)
        Forms![F_fond].Form![SF_CAF]!lst_flag_check_CAF.Value = Rst.Fields(49)
        Forms![F_fond].Form![SF_CAF]!txt_matricule_user_CAF.Value = Rst.Fields(50)
     
        Forms![F_fond].Form![SF_H24]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_H24]!txt_matricule_user_CAF.Value = Rst.Fields(50)
        Forms![F_fond].Form![SF_H24]!txt_id_H24.Value = Rst.Fields(51)
        Forms![F_fond].Form![SF_H24]!grop_acces_H24.Value = Rst.Fields(52)
        Forms![F_fond].Form![SF_H24]!txt_date_exp_ADAH.Value = Rst.Fields(53)
        Forms![F_fond].Form![SF_H24]!coche_H24_basalte.Value = Rst.Fields(54)
        Forms![F_fond].Form![SF_H24]!coche_H24_conex.Value = Rst.Fields(55)
        Forms![F_fond].Form![SF_H24]!coche_H24_dunes.Value = Rst.Fields(56)
        Forms![F_fond].Form![SF_H24]!coche_H24_HAUS.Value = Rst.Fields(57)
        Forms![F_fond].Form![SF_H24]!coche_H24_PAC.Value = Rst.Fields(58)
        Forms![F_fond].Form![SF_H24]!coche_H24_PER.Value = Rst.Fields(59)
        Forms![F_fond].Form![SF_H24]!coche_H24_PPD.Value = Rst.Fields(60)
        Forms![F_fond].Form![SF_H24]!coche_H24_TAC.Value = Rst.Fields(61)
        Forms![F_fond].Form![SF_H24]!txt_date_mail_CRE_H24.Value = Rst.Fields(62)
        Forms![F_fond].Form![SF_H24]!lst_H24_basalte_decis.Value = Rst.Fields(63)
        Forms![F_fond].Form![SF_H24]!lst_H24_conex_decis.Value = Rst.Fields(64)
        Forms![F_fond].Form![SF_H24]!lst_H24_dunes_decis.Value = Rst.Fields(65)
        Forms![F_fond].Form![SF_H24]!lst_H24_HAUS_decis.Value = Rst.Fields(66)
        Forms![F_fond].Form![SF_H24]!lst_H24_PAC_decis.Value = Rst.Fields(67)
        Forms![F_fond].Form![SF_H24]!lst_H24_PER_decis.Value = Rst.Fields(68)
        Forms![F_fond].Form![SF_H24]!lst_H24_PPD_decis.Value = Rst.Fields(69)
        Forms![F_fond].Form![SF_H24]!lst_H24_TAC_decis.Value = Rst.Fields(70)
        Forms![F_fond].Form![SF_H24]!txt_date_mail_manager_H24.Value = Rst.Fields(71)
        Forms![F_fond].Form![SF_H24]!txt_date_maj_ADAH.Value = Rst.Fields(72)
        Forms![F_fond].Form![SF_H24]!txt_commentaires_H24.Value = Rst.Fields(73)
        Forms![F_fond].Form![SF_H24]!lst_flag_check_H24.Value = Rst.Fields(74)
        Forms![F_fond].Form![SF_H24]!txt_matricule_user_H24.Value = Rst.Fields(75)
     
        Forms![F_fond].Form![SF_NDF]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_NDF]!txt_id_NDF.Value = Rst.Fields(76)
        Forms![F_fond].Form![SF_NDF]!grop_etat_NDF.Value = Rst.Fields(77)
        Forms![F_fond].Form![SF_NDF]!txt_date_mail_NDF.Value = Rst.Fields(78)
        Forms![F_fond].Form![SF_NDF]!txt_commentaires_NDF.Value = Rst.Fields(79)
        Forms![F_fond].Form![SF_NDF]!lst_flag_check_NDF.Value = Rst.Fields(80)
        Forms![F_fond].Form![SF_NDF]!txt_matricule_user_NDF.Value = Rst.Fields(81)
     
        Forms![F_fond].Form![SF_PM]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_PM]!txt_id_PM.Value = Rst.Fields(82)
        Forms![F_fond].Form![SF_PM]!grop_etat_lieu_PM.Value = Rst.Fields(83)
        Forms![F_fond].Form![SF_PM]!txt_date_mail_PM.Value = Rst.Fields(84)
        Forms![F_fond].Form![SF_PM]!txt_commentaires_PM.Value = Rst.Fields(85)
        Forms![F_fond].Form![SF_PM]!lst_flag_check_PM.Value = Rst.Fields(86)
        Forms![F_fond].Form![SF_PM]!txt_matricule_user_PM.Value = Rst.Fields(87)
     
        Forms![F_fond].Form![SF_A7]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_A7]!txt_id_A7.Value = Rst.Fields(88)
        Forms![F_fond].Form![SF_A7]!txt_date_mail_GTS.Value = Rst.Fields(89)
        Forms![F_fond].Form![SF_A7]!grop_etat_lieu_A7.Value = Rst.Fields(90)
        Forms![F_fond].Form![SF_A7]!txt_date_mail_rep_manag.Value = Rst.Fields(91)
        Forms![F_fond].Form![SF_A7]!grop_decis_manager.Value = Rst.Fields(92)
        Forms![F_fond].Form![SF_A7]!txt_date_rel_GTS.Value = Rst.Fields(93)
        Forms![F_fond].Form![SF_A7]!txt_commentaires_A7.Value = Rst.Fields(94)
        Forms![F_fond].Form![SF_A7]!lst_flag_check_A7.Value = Rst.Fields(95)
        Forms![F_fond].Form![SF_A7]!txt_matricule_user_A7.Value = Rst.Fields(96)
     
        Forms![F_fond].Form![SF_MKD]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_MKD]!txt_id_MKD.Value = Rst.Fields(97)
        Forms![F_fond].Form![SF_MKD]!grop_etat_lieu_MKD.Value = Rst.Fields(98)
        Forms![F_fond].Form![SF_MKD]!txt_date_mail_MKD.Value = Rst.Fields(99)
        Forms![F_fond].Form![SF_MKD]!txt_commentaires_MKD.Value = Rst.Fields(100)
        Forms![F_fond].Form![SF_MKD]!lst_flag_check_MKD.Value = Rst.Fields(101)
        Forms![F_fond].Form![SF_MKD]!txt_matricule_user_MKD.Value = Rst.Fields(102)
     
        Forms![F_fond].Form![SF_RLM]!txt_id_ML.Value = Rst.Fields(0)
        Forms![F_fond].Form![SF_RLM]!txt_id_RLM.Value = Rst.Fields(103)
        Forms![F_fond].Form![SF_RLM]!txt_date_mail_ADAH_RLM.Value = Rst.Fields(104)
        Forms![F_fond].Form![SF_RLM]!grop_retour_ADAH.Value = Rst.Fields(105)
        Forms![F_fond].Form![SF_RLM]!txt_comment_ADAH_RLM.Value = Rst.Fields(106)
        Forms![F_fond].Form![SF_RLM]!txt_date_mail_Atlas_RLM.Value = Rst.Fields(107)
        Forms![F_fond].Form![SF_RLM]!grop_retour_ATLAS.Value = Rst.Fields(108)
        Forms![F_fond].Form![SF_RLM]!txt_comment_ATLAS_RLM.Value = Rst.Fields(109)
        Forms![F_fond].Form![SF_RLM]!lst_flag_check_RLM.Value = Rst.Fields(110)
        Forms![F_fond].Form![SF_RLM]!txt_matricule_user_RLM.Value = Rst.Fields(111)
     
        Rst.Close
     
    End Sub

    Et je ne sais pas si la formulation ci dessous est correcte car pour le moment il ne m'est pas possible de tester.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Forms![F_fond].Form![SF_ML]!txt_date_saisie.Value = Rst.Fields(1)
    Merci pour votre aide et belle journée 🌞

  8. #8
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    De plus il se passe quelque chose que je ne comprends pas,
    Même en enregistrant les modification de mon formulaire, quand je réouvre ma base, le code sur l'évènement au clic à disparut
    Cela fait deux fois que je fais un compacter/réparer puis recréé mon évènement sur clic et colle le code que j'ai sur Notepad++ et cela disparait à nouveau

  9. #9
    Expert confirmé
    Homme Profil pro
    retraité
    Inscrit en
    Juin 2012
    Messages
    3 183
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : retraité
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juin 2012
    Messages : 3 183
    Points : 5 515
    Points
    5 515
    Par défaut
    Bonjour,

    Tout cela me semble bien compliqué! Vu de loin, tout cela devrait se faire sur l'événement "Sur ouverture" du formulaire F_fond avec les sous-formulaires liés au formulaire parent. Mais bon! Pour ce qui de sSQL il y a sans doute un " qui traine mais cela pourrait sans doute être simplifié et réduit à ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    sSQL = "SELECT T_ML.*, T_CAF.*, T_H24.*, T_NDF.*, T_PM.*, T_A7.*, T_MKD.*, T_RLM.* FROM ((((((T_ML INNER JOIN T_A7 ON T_ML.id_ML = T_A7.id_ML) INNER JOIN T_CAF ON T_ML.id_ML = T_CAF.id_ML) INNER JOIN T_H24 ON T_ML.id_ML = T_H24.id_ML) INNER JOIN T_MKD ON T_ML.id_ML = T_MKD.id_ML) INNER JOIN T_NDF ON T_ML.id_ML = T_NDF.id_ML) INNER JOIN T_PM ON T_ML.id_ML = T_PM.id_ML) INNER JOIN T_RLM ON T_ML.id_ML = T_RLM.id_ML WHERE (((T_ML.id_ML)=" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1] & "));"
    sachant que .* signifie de reprendre tous les champs de la table.

    J'ajouterais une instruction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Debug.Print [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1]
    juste avant sSQL pour vérifier que c'est bien ce que je demande.

    Enfin, une autre solution serait peut-être de simplement ouvrir le formulaire en utilisant l'option OpenArgs, quelque chose du genre:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
        DoCmd.OpenForm "F_fond", , , "T_ML.id_ML=" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1]
    Cordialement.

  10. #10
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    merci EricDgn,
    Je vais regarder cela demain, n'ai pas le temps cet aprèm'
    Je verrai si j'arrive à simplifier un peu

  11. #11
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Bonjour à tous,

    J'ai corrigé le code comme ceci mais je ne peux pas le tester pour le moment et le déboguer ne me sort plus d'erreur.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Debug.Print [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1]
    sSQL = "SELECT T_ML.*, T_CAF.*, T_H24.*, T_NDF.*, T_PM.*, T_A7.*, T_MKD.*, T_RLM.* FROM ((((((T_ML INNER JOIN T_A7 ON T_ML.id_ML = T_A7.id_ML) INNER JOIN T_CAF ON T_ML.id_ML = T_CAF.id_ML) INNER JOIN T_H24 ON T_ML.id_ML = T_H24.id_ML) INNER JOIN T_MKD ON T_ML.id_ML = T_MKD.id_ML) INNER JOIN T_NDF ON T_ML.id_ML = T_NDF.id_ML) INNER JOIN T_PM ON T_ML.id_ML = T_PM.id_ML) INNER JOIN T_RLM ON T_ML.id_ML = T_RLM.id_ML WHERE (((T_ML.id_ML)=" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)] & "));"
    Par contre, j'ai voulu lancer la requête en mode "normal" car je l'ai construite avant de la passer en sql pour l'intégrer dans mon code.


    Nom : req.JPG
Affichages : 179
Taille : 107,1 Ko

    Et j'ai eu ce message :

    crochet non valide du nom " Comme "*" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)] "

    C'est donc surement la que ça bloque

  12. #12
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Je m'aperçois aussi d'une chose et peut etre que je le fais mal

    Je construis ma requête et ensuite je l'affiche en mode SQL comme ci-dessous et ensuite je copie ces lignes dans mon code VBA.
    Et je me retrouve avec une erreur de compilation alors que je n'ai rien modifié

    Nom : req-2.JPG
Affichages : 170
Taille : 20,8 Ko

    Exemple:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
        Dim db As dao.Database
        Dim Rst As dao.Recordset
        Dim sSQL As String
     
    	sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil
    FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG
    WHERE (((T_employes.Global_HR_ID) Like "*" & Forms![F_fond].Form![txt_matricule]));"
     
    Set db = CurrentDb
        Set Rst = db.openrecordset(sSQL, dbOpenSnapshot)

  13. #13
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 260
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 260
    Points : 19 423
    Points
    19 423
    Billets dans le blog
    63
    Par défaut
    Bonjour,

    Le code SQL passé au recordset ne doit pas contenir de paramètre, ou alors il faut les évaluer avant, comme ceci par exemple :

    Code VBA : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     Dim db As dao.Database
        Dim Rst As dao.Recordset
        Dim sSQL As String
     
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil " & _
                    "FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG " & _
                    "WHERE T_employes.Global_HR_ID Like '*" & Forms![F_fond]![txt_matricule] & "';"
     
        Set db = CurrentDb
        Set Rst = db.openrecordset(sSQL, dbOpenSnapshot)

    Pour plus d'infos, je vous renvoie à cette contribution.
    Vous trouverez dans la FAQ, les sources ou les tutoriels, de l'information accessible au plus grand nombre, plein de bonnes choses à consulter sans modération

    Des tutoriels pour apprendre à créer des formulaires de planning dans vos applications Access :
    Gestion sur un planning des présences et des absences des employés
    Gestion des rendez-vous sur un calendrier mensuel


    Importer un fichier JSON dans une base de données Access :
    Import Fichier JSON

  14. #14
    Expert confirmé
    Homme Profil pro
    retraité
    Inscrit en
    Juin 2012
    Messages
    3 183
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : retraité
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Juin 2012
    Messages : 3 183
    Points : 5 515
    Points
    5 515
    Par défaut
    Juste pour attirer l'attention sur les délimiteurs ' dans la clause WHERE en considérant que [txt_matricule] est du texte:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil" & _
               " FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG" & _
               " WHERE T_employes.Global_HR_ID Like '*" & Forms![F_fond].Form![txt_matricule] & "*';"
    'ou  
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil" & _
               " FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG" & _
               " WHERE T_employes.Global_HR_ID = '" & Forms![F_fond].Form![txt_matricule] & "';"
    Cordialement.

  15. #15
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Citation Envoyé par User Voir le message
    Bonjour,

    Le code SQL passé au recordset ne doit pas contenir de paramètre, ou alors il faut les évaluer avant, comme ceci par exemple :
    Merci User, j'en prend note et ferai le test

  16. #16
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Citation Envoyé par EricDgn Voir le message
    Juste pour attirer l'attention sur les délimiteurs ' dans la clause WHERE en considérant que [txt_matricule] est du texte:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil" & _
               " FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG" & _
               " WHERE T_employes.Global_HR_ID Like '*" & Forms![F_fond].Form![txt_matricule] & "*';"
    'ou  
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil" & _
               " FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG" & _
               " WHERE T_employes.Global_HR_ID = '" & Forms![F_fond].Form![txt_matricule] & "';"
    Cordialement.
    Merci EricDgn je vais aussi voir

  17. #17
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 260
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 260
    Points : 19 423
    Points
    19 423
    Billets dans le blog
    63
    Par défaut
    Citation Envoyé par EricDgn Voir le message
    Juste pour attirer l'attention sur les délimiteurs ' dans la clause WHERE en considérant que [txt_matricule] est du texte:
    ..
    C'est juste merci, manque d'attention je corrige
    Vous trouverez dans la FAQ, les sources ou les tutoriels, de l'information accessible au plus grand nombre, plein de bonnes choses à consulter sans modération

    Des tutoriels pour apprendre à créer des formulaires de planning dans vos applications Access :
    Gestion sur un planning des présences et des absences des employés
    Gestion des rendez-vous sur un calendrier mensuel


    Importer un fichier JSON dans une base de données Access :
    Import Fichier JSON

  18. #18
    Expert éminent sénior
    Avatar de tee_grandbois
    Homme Profil pro
    retraité
    Inscrit en
    Novembre 2004
    Messages
    8 648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Novembre 2004
    Messages : 8 648
    Points : 14 626
    Points
    14 626
    Par défaut
    bonsoir mgascult,
    Je construis ma requête et ensuite je l'affiche en mode SQL comme ci-dessous et ensuite je copie ces lignes dans mon code VBA.
    Et je me retrouve avec une erreur de compilation alors que je n'ai rien modifié
    pour information un simple copier/coller du code SQL vers VBA ne suffit pas, si tu regardes bien le code de l'avant dernier message de User, tu verras qu'il y a 2 caractères en fin de chaque ligne (sauf la dernière) : & _
    il s'agit du caractère de concaténation (&) pour indiquer que la partie de texte précédent doit être accolé à celle qui suit ce caractère (délimité par des guillemets "")
    et du caractère de continuation (_) pour signifier que la ligne de code se poursuit à la ligne suivante.

    Pour ce qui est de ceci:
    j'ai eu ce message :

    crochet non valide du nom " Comme "*" & [Forms]![F_select_suivi_fiche_ML]![lst_selct_fiche_ML_1.Column(0)] "
    le crochet après Column(0) doit être placé à la fin de [lst_selct_fiche_ML_1 puisque les crochets délimitent le nom des objets, ici tu délimites un objet (le contrôle [lst_selct_fiche_ML_1]) et la propriété Colonne de cet objet
    Quand on est derrière l'écran on n'a aucun clavier sous les mains ...
    ah non ? donc devant l'écran c'est la connectique ?

  19. #19
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    bonjour à Tous,

    merci tee_grandbois je me note aussi cela.
    J'ai encore beaucoup à apprendre et vous remercie tous pour vos conseils et aides.
    Aujourd'hui se sera sans Access mais je reprendrai tout cela à partir de la semaine prochaine.

    Excellent week-end à tous 🌞

  20. #20
    Membre régulier Avatar de mgascult
    Homme Profil pro
    Logistique Immobilière
    Inscrit en
    Août 2013
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Logistique Immobilière
    Secteur : Finance

    Informations forums :
    Inscription : Août 2013
    Messages : 414
    Points : 106
    Points
    106
    Par défaut
    Bonjour à tous,

    La requête fonctionne merci 😊
    J’ai un autre souci et sûrement un problème de formulation.

    Dans mon test, en lançant la requête manuellement avec un matricule, j’ai un résultat avec 5 lignes car la personne à 5 accès H24 différents.
    Or seule la case « H24_TAC » est cochée sur mon formulaire ☹ vu que je n’ai pas l’habitude d’utiliser « Rst.Fields » je dois mal m’y prendre.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Private Sub but_recherche_H24_Click() 'lance la recherche d’accès H24 pour le ML
        Dim db As dao.Database
        Dim Rst As dao.Recordset
        Dim sSQL As String
     
        sSQL = "SELECT T_employes.Global_HR_ID, T_ADAH_H24.Profil" & _
               " FROM T_employes LEFT JOIN T_ADAH_H24 ON T_employes.igg = T_ADAH_H24.IGG" & _
               " WHERE T_employes.Global_HR_ID = '" & Forms![F_fond].Form![SF_ML]![txt_matricule] & "';"
     
    Set db = CurrentDb
        Set Rst = db.OpenRecordset(sSQL, dbOpenSnapshot)
     
    If Rst.Fields(1) = "GBIS ACCES H24 TOURS SG" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_TAC.Value = True
    ElseIf Rst.Fields(1) = "ACCES H24 PERSPECT" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_PPD.Value = True
    ElseIf Rst.Fields(1) = " ACCES H24 PARIS" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_basalte.Value = True
    ElseIf Rst.Fields(1) = " ACCES H24 ST-DENIS" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_dunes.Value = True
    ElseIf Rst.Fields(1) = "ACCES H24 OPERA" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_HAUS.Value = True
    ElseIf Rst.Fields(1) = "ACCES H24 BDX" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_conex.Value = True
    ElseIf Rst.Fields(1) = "ACCES H24 STG" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_PAC.Value = True
    ElseIf Rst.Fields(1) = "ACCES H24 PERI" Then
        Forms![F_fond].Form![SF_H24]!coche_H24_PER.Value = True
    Else
        Forms![F_fond].Form![SF_H24]!grop_acces_H24.Value = "2"
     
    End If
    End Sub
    Merci pour votre aide et belle journée🌞

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 4 1234 DernièreDernière

Discussions similaires

  1. [AC-2007] Limitation zone de liste déroulante
    Par lio33 dans le forum IHM
    Réponses: 8
    Dernier message: 23/03/2011, 11h05
  2. Limiter les résultats d'une zone de liste déroulante (requête)
    Par Tipstitou dans le forum Requêtes et SQL.
    Réponses: 5
    Dernier message: 11/02/2008, 11h01
  3. Réponses: 6
    Dernier message: 15/12/2005, 21h20
  4. Zone de liste déroulante, valeur de requete et fixe
    Par Fritzoune dans le forum Access
    Réponses: 4
    Dernier message: 12/10/2005, 17h21
  5. Zone de liste déroulante
    Par noname_971 dans le forum Access
    Réponses: 9
    Dernier message: 10/09/2005, 21h16

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