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

VBA Access Discussion :

Sélection en fonction de requête en VBA [AC-2007]


Sujet :

VBA Access

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut Sélection en fonction de requête en VBA
    Bonjour à tous,

    je vous explique ma problématique
    le titre du forum n'est pas très parlant mais je ne savais pas trop comment nommer celui-ci


    voila ce que j'aimerais faire
    sous access j'ai un formulaire qui me permet de choirir une date (année) dans un champ:

    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
     
     
    Private Sub Cmd_recherche_annee_Click()
    Dim sql_annee As String
    Dim rs As DAO.Recordset
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) ='" & Me.Annee & "' ;"
    Set rs = CurrentDb.OpenRecordset(sql_annee)
    If Not rs.EOF Then
     'On supprime les enregistrements de la table avant de la remettre à jour
     DoCmd.SetWarnings False
     DoCmd.RunSQL "DELETE * FROM T_synthese;"
     
     
     'DoCmd.OpenReport "ES_SyntheseAnnee", acViewPreview
    Else
      MsgBox "Année incorrecte ", vbInformation, "Année"
    End If
    rs.Close
    Set rs = Nothing
    End Sub

    je me suis créer une nouvelle table T_synthese que je vide à chaque fois afin de pouvoir la remplir avec les données que j'aimerais pouvoir récupérer

    en gros mon premier select me fait une sélection des lignes de la table T_echafaudage en fonction de l'année passée en paramètre

    ce que j'aimerais maintenant c'est pouvoir faire des sélections dans les entrées afin de pouvoir insérer les données que je veux dans T_synthese

    en gros faire une boucle sur tous les enregistrements et garder ceux que je veux en fonction de critères

    par exemple insérer dans ma nouvelle table, pour chaque ligne parcourue le numero_echaufaudage et d'autres critères par exemple si un champ =4 alors ajouter dans ma table "toto"

    merci de votre aide car je mouline
    Blado_sap

  2. #2
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap,

    regarde la réponse dans cette faq : http://access.developpez.com/faq/?page=SQL#Parcourirrst

    une fois récupéré les champs souhaités un insert dans ta table temporaire

    pour l'insertion ici : http://access.developpez.com/faq/?page=SQL#DiffRstSQL

    pour ta requête :

    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) ='" & Me.Annee & "' ;"

    à mettre en numérique

    Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) =" & Me.Annee & " ;"

    Cldt

    jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Bonjour Jim,

    merci de ton aide

    par contre comment je fais pour récupérer mes champs dans des variables?

    par exemple dans temp_mois je voudrais récupérer le mois de mon champ date_pose qui est dans ma table T_echafaudage
    et idem dans temp_urgence qui contiendrait le champ urgence de ma table T_echafaudage??

    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
     
     
    Private Sub Cmd_recherche_annee_Click()
    Dim sql_annee As String
    Dim rs As DAO.Recordset
    'On supprime les enregistrements de la table avant de la remettre à jour
    DoCmd.SetWarnings False
    DoCmd.RunSQL "DELETE * FROM T_synthese;"
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) =" & Me.Annee & " ;"
    Set rs = CurrentDb.OpenRecordset(sql_annee)
     
    If Not rs.EOF Then
      rs.MoveFirst
      While Not rs.EOF
         ' Code
         Dim temp_mois As Integer
         Dim temp_urgence as Integer
         temp_mois = Month( ??? )
         temp_urgence = ???
     
         rs.MoveNext
      Wend
    Else
      MsgBox "Année incorrecte ", vbInformation, "Année"
    End If
     
      'DoCmd.OpenReport "ES_SyntheseAnnee", acViewPreview
     
    rs.Close
    Set rs = Nothing
    End Sub

    D'avance merci
    Blado_sap

  4. #4
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap


    Très simplement exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    temp_urgence = rs![temp_urgence]
    si temp_urgence est le champ de ta table

    Jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Merci Jim

    effectivement j'avais la tete ailleurs lors de ma question

    par contre quelle est la différence entre

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
     
         Dim temp_mois As String
         temp_mois = Month(rs("date_pose"))
    et ce que tu proposes avec le !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
     
    temp_urgence = rs![temp_urgence]
    Merci
    Blado_sap

  6. #6
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap,

    c'était juste un exemple soulevé par ton code temp_urgence = ???.

    J'en ai donc déduit que temp_Urgence était une variable à alimenter par rapport à la récupération d'un champ.


    La bonne syntaxe est donc :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Dim temp_mois As String
         temp_mois = Month(rs("date_pose"))
    Cela dit puisque la requête répond à ton filtre tu aurais aussi bien pu mettre

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Dim temp_mois As String
         temp_mois =Me.Annee

    JimboLion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    merci

    par contre non je n'aurais pas pu mettre la deuxieme solution que tu proposes car je veux récupérer le mois et non l'année

    Blado_sap

  8. #8
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_Sap

    Bien vu, je suis allé un peu trop vite, de mauvaise foi je dirai c'est pour savoir si tu suivais

    jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    oui je me doute bien ;-)))))))

  10. #10
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Bonjour Jim,

    alors maintenant je voudrais faire autre chose sur ma sélection

    j'ai inséré mes données dans ma nouvelle table T_synthese en fonction de certains critères
    jusque tout se passe bien

    j'ai ma table T_synthese qui est de la forme suivante :

    cf fichier word joint


    ce que j'aimerais c'est pouvoir en créant une table qu'elle soit de la forme suivante

    je voudrais pouvoir dans cette nouvelle table (en fonction de ce que j'ai dans lma table t_synthese quand j'insère dans la nouvelle table que ca me fasse des regroupements en fonction des champs nom_entreprise et nom_batiment

    du style:

    cf document word joint

    et voici mon code initial:

    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
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
     
     
    Private Sub Cmd_recherche_annee_Click()
     
    'Déclaration des variables
    Dim sql_annee As String
    Dim rs As DAO.Recordset
    Dim sql_bordereau As String
    Dim Bdx As DAO.Recordset
    Dim tmp_mois_pose As Integer, tmp_mois_depose As Integer, temp_urgence As Integer
    Dim temp_mois_pose As String, temp_mois_depose As String, temp_bordereau As String, temp_entreprise As String, temp_batiment As String, temp_echafaudage As String
    Dim Nb_jrs As Integer, Annee_depose As Integer, temp_ech_30 As Integer, temp_hpl As Single, temp_loc As Integer
    Dim temp_longueur As Single, temp_largeur As Single, temp_hauteur As Single, temp_volume As Single
    Dim ech_1_20 As Single, ech_20 As Single, temp_prevenance As Integer
    Dim temp_bdx_pose As Date, temp_bdx_demande_pose As Date, Nb_jrs_bdx As Integer
     
    'On supprime les enregistrements de la table avant de la remettre à jour
    DoCmd.SetWarnings False
    DoCmd.RunSQL "DELETE * FROM T_synthese;"
     
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) =" & Me.Annee & " ;"
    Set rs = CurrentDb.OpenRecordset(sql_annee)
     
    If Not rs.EOF Then
      'on se positionne sur le premier enregistrement
      rs.MoveFirst
      'On boucle sur chaque enregistrement
      While Not rs.EOF
     
        'on récupère le numéro de bordereau
        temp_bordereau = rs("numero_bordereau")
     
        'on récupère le numéro d'échafaudage
        temp_echafaudage = rs("numero_echafaudage")
     
        'on récupère et teste le mois de pose
        If Not IsNull(rs("date_pose")) Then
        tmp_mois_pose = Month(rs("date_pose"))
        If tmp_mois_pose = 1 Then
            temp_mois_pose = "Janvier"
        End If
        If tmp_mois_pose = 2 Then
            temp_mois_pose = "Février"
        End If
        If tmp_mois_pose = 3 Then
            temp_mois_pose = "Mars"
        End If
        If tmp_mois_pose = 4 Then
            temp_mois_pose = "Avril"
        End If
        If tmp_mois_pose = 5 Then
            temp_mois_pose = "Mai"
        End If
        If tmp_mois_pose = 6 Then
            temp_mois_pose = "Juin"
        End If
        If tmp_mois_pose = 7 Then
            temp_mois_pose = "Juillet"
        End If
        If tmp_mois_pose = 8 Then
            temp_mois_pose = "Août"
        End If
        If tmp_mois_pose = 9 Then
            temp_mois_pose = "Septembre"
        End If
        If tmp_mois_pose = 10 Then
            temp_mois_pose = "Octobre"
        End If
        If tmp_mois_pose = 11 Then
            temp_mois_pose = "Novembre"
        End If
        If tmp_mois_pose = 12 Then
            temp_mois_pose = "Décembre"
        End If
        End If
     
        'on récupère et teste le mois de dépose
        If Not IsNull(rs("date_demande_depose")) Then
        tmp_mois_depose = Month(rs("date_demande_depose"))
        If tmp_mois_depose = 1 Then
            temp_mois_depose = "Janvier"
        End If
        If tmp_mois_depose = 2 Then
            temp_mois_depose = "Février"
        End If
        If tmp_mois_depose = 3 Then
            temp_mois_depose = "Mars"
        End If
        If tmp_mois_depose = 4 Then
            temp_mois_depose = "Avril"
        End If
        If tmp_mois_depose = 5 Then
            temp_mois_depose = "Mai"
        End If
        If tmp_mois_depose = 6 Then
            temp_mois_depose = "Juin"
        End If
        If tmp_mois_depose = 7 Then
            temp_mois_depose = "Juillet"
        End If
        If tmp_mois_depose = 8 Then
            temp_mois_depose = "Août"
        End If
        If tmp_mois_depose = 9 Then
            temp_mois_depose = "Septembre"
        End If
        If tmp_mois_depose = 10 Then
            temp_mois_depose = "Octobre"
        End If
        If tmp_mois_depose = 11 Then
            temp_mois_depose = "Novembre"
        End If
        If tmp_mois_depose = 12 Then
            temp_mois_depose = "Décembre"
        End If
     
        Annee_depose = Year(rs("date_demande_depose"))
        'Calcul du nombre de jour entre la date de pose et la date de dépose
        Nb_jrs = DateDiff("d", rs("date_pose"), rs("date_demande_depose"))
        If Nb_jrs < 0 Then
        Nb_jrs = 0
        End If
        Else
        Nb_jrs = 0
        End If
     
        'Si le nombre de jours entre la date de pose et la date de dépose est supérieur à 30 jours
        If Nb_jrs > 30 Then
            temp_ech_30 = 1
            temp_loc = 1
        Else
            temp_ech_30 = 0
            temp_loc = 0
        End If
     
        'on récupère le coef d'urgence
        'Si la case est cochée (valeur = -1)
        If rs("coef_K7") = -1 Then
        temp_urgence = 1
        End If
     
        'on récupère la hauteur HPL (hauteur du plancher) --> correspond à la hauteur du garde corps - 1mètre
        If rs("hauteur") > 0 Then
        temp_hpl = rs("hauteur") - 1
        If temp_hpl < "1,5" Then
            temp_hpl = 1
        Else
            temp_hpl = 0
        End If
        Else
            temp_hpl = 0
        End If
     
        'on récupère le produit de la Longueur x Largeur x Hauteur (Volume)
        temp_hauteur = rs("hauteur")
        temp_largeur = rs("largeur")
        temp_longueur = rs("longueur")
        temp_volume = temp_longueur * temp_largeur * temp_hauteur
        If (temp_volume > 1 And temp_volume < 20) Then
            ech_1_20 = 1
        Else
            ech_1_20 = 0
        End If
        If temp_volume > 20 Then
            ech_20 = 1
        Else
            ech_20 = 0
        End If
     
        'on sélectionne dans la table T_bordereau les informations nécessaires
        sql_bordereau = "SELECT * FROM T_Bordereau WHERE numero_bordereau = '" & temp_bordereau & "';"
        Set Bdx = CurrentDb.OpenRecordset(sql_bordereau)
        If Not Bdx.EOF Then
            temp_entreprise = Bdx("nom_entreprise")
            temp_batiment = Bdx("nom_batiment")
           ' temp_bdx_pose = Bdx("date_pose")
           ' temp_bdx_demande_pose = Bdx("date_demande_pose")
        Else
            MsgBox "Aucun enregistrement dans la table bordereau ", vbInformation, "Bordereau"
        End If
     
        'on récupère la prévenance
        If Not IsNull(Bdx("date_pose")) Then
            If Not IsNull(Bdx("date_demande_pose")) Then
                'Calcul du nombre de jour entre la date de pose et la date de demande de pose (bordereau)
                Nb_jrs_bdx = DateDiff("d", Bdx("date_demande_pose"), Bdx("date_pose"))
                If Nb_jrs_bdx < 0 Then
                    Nb_jrs_bdx = 0
                End If
            Else
                Nb_jrs_bdx = 0
            End If
        Else
            Nb_jrs_bdx = 0
        End If
     
        'Si le nombre de jours entre la date de demande de pose et la date de pose est supérieur à 4 jours
        If Nb_jrs_bdx > 4 Then
            temp_prevenance = 1
        Else
            temp_prevenance = 0
        End If
     
        'On insert les données dans la table T_Synthese
        DoCmd.SetWarnings False
        DoCmd.RunSQL "INSERT INTO T_synthese (numero_bordereau,numero_echafaudage,mois_pose,mois_depose,urgence,entreprise,batiment,annee_pose,annee_depose,Nb_jrs,ech_30,hpl,ech_1_20,ech_20,ech_loc,prevenance) VALUES('" & temp_bordereau & "', '" & temp_echafaudage & "','" & temp_mois_pose & "', '" & temp_mois_depose & "', " & temp_urgence & ", '" & temp_entreprise & "', '" & temp_batiment & "', " & Me.Annee & "," & Annee_depose & ", " & Nb_jrs & ", " & temp_ech_30 & ", '" & temp_hpl & "', '" & ech_1_20 & "', '" & ech_20 & "', '" & temp_loc & "', '" & temp_prevenance & "' );"
     
     
        'on passe à l'enregistrement suivant
        rs.MoveNext
      Wend
    Else
      MsgBox "Année incorrecte ", vbInformation, "Année"
    End If
     
      'DoCmd.OpenReport "ES_SyntheseAnnee", acViewPreview
     
    rs.Close
    Set rs = Nothing
    End Sub
    d'avance merci
    blado_sap


    T.docx

  11. #11
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap,

    Quelle relation entre T_Ligne et T_synthese ?

    Une fois levée cette question, idéalement il faut créer une nouvelle requête de type regroupement avec la jointure de tes deux tables en ensuite à partir de celle-ci utiliser les techniques de tableaux croisés dynamiques (TCD). Sur cette dernière partie nous verrons à poster un autre sujet, car pas le plus compétent en la matière.

    regarde ici :

    http://f-leb.developpez.com/tutoriel..._regroupement/

    les tcd :

    http://mhubiche.developpez.com/video...ses-dynamique/

    Donc step 1 ta requete de regroupement, step 2 le tcd

    jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  12. #12
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Bonjour Jim,

    il n'y a aucun lien entre T_ligne et T_synthese

    je voudrais juste pouvoir dans ma nouvelle table que je dois créer que ca me créé autant de ligne dans ma nouvelle table que de ligne que j'ai dans ma table T_ligne

    en etant regroupe par nom_batiment et nom_entreprise

    Blado_sap

  13. #13
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap bonjour,

    j'ai à peu près compris tes souhaits après relecture de ton docX. Cela dit une confirmation, le regroupement doit bien s'effectuer sur les critères suivants : Entreprise + Batiment + Information à partir de T-Synthese.

    Question 1 : Comment rapprocher Information par rapport à T_Synthese (j'ai bien une liste de valeur, mais je ne vois pas le rapprochement)
    Question 2 : Quelles sont les règles d'incrémentations des totaux ?

    A partir de là, nous élaborerons uns stratégie basée sur une requête de regroupement et les règles de rupture permettant de générer via vba la table souhaitée (rien de bien complexe)!

    jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  14. #14
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Bonjour Jim,

    j'ai procédé différemment tout compte fait plutôt que de passer par des requêtes

    je suis parti de ma première table puis j'ai inséré de la forme que je voulais dans une seconde

    par contre le soucis que j'ai maintenant c'est la lenteur de mon morceau de programme

    est il possible d'améliorer ce morceau de programme afin de l'optimiser?


    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
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
     
     
    Private Sub Cmd_recherche_annee_Click()
     
    'Déclaration des variables
    Dim sql_annee As String
    Dim rs As DAO.Recordset
    Dim sql_bordereau As String
    Dim Bdx As DAO.Recordset
    Dim sql_synth As String
    Dim rs_synth As DAO.Recordset
     
    Dim tmp_mois_pose As Integer, tmp_mois_depose As Integer, temp_urgence As Integer
    Dim temp_mois_pose As String, temp_mois_depose As String, temp_bordereau As String, temp_entreprise As String, temp_batiment As String, temp_echafaudage As String
    Dim Nb_jrs As Integer, Annee_depose As Integer, temp_ech_30 As Integer, temp_hpl As Single, temp_loc As Integer
    Dim temp_longueur As Single, temp_largeur As Single, temp_hauteur As Single, temp_volume As Single
    Dim ech_1_20 As Single, ech_20 As Single, temp_prevenance As Integer
    Dim Nb_jrs_bdx As Integer
     
     
    'On supprime les enregistrements des tables avant de les remettre à jour
    DoCmd.SetWarnings False
    DoCmd.RunSQL "DELETE * FROM T_synthese;"
    DoCmd.RunSQL "DELETE * FROM T_synth;"
     
    '***************************************** T_SYNTHESE BEGIN ********************************************************
    sql_annee = "SELECT * FROM T_echafaudage WHERE YEAR(date_pose) =" & Me.Annee & " ;"
    Set rs = CurrentDb.OpenRecordset(sql_annee)
     
    If Not rs.EOF Then
      'on se positionne sur le premier enregistrement
      rs.MoveFirst
      'On boucle sur chaque enregistrement
      While Not rs.EOF
     
        'on récupère le numéro de bordereau
        temp_bordereau = rs("numero_bordereau")
     
        'on récupère le numéro d'échafaudage
        temp_echafaudage = rs("numero_echafaudage")
     
        'on récupère et teste le mois de pose
        If Not IsNull(rs("date_pose")) Then
        tmp_mois_pose = Month(rs("date_pose"))
        If tmp_mois_pose = 1 Then
            temp_mois_pose = "Janvier"
        End If
        If tmp_mois_pose = 2 Then
            temp_mois_pose = "Février"
        End If
        If tmp_mois_pose = 3 Then
            temp_mois_pose = "Mars"
        End If
        If tmp_mois_pose = 4 Then
            temp_mois_pose = "Avril"
        End If
        If tmp_mois_pose = 5 Then
            temp_mois_pose = "Mai"
        End If
        If tmp_mois_pose = 6 Then
            temp_mois_pose = "Juin"
        End If
        If tmp_mois_pose = 7 Then
            temp_mois_pose = "Juillet"
        End If
        If tmp_mois_pose = 8 Then
            temp_mois_pose = "Août"
        End If
        If tmp_mois_pose = 9 Then
            temp_mois_pose = "Septembre"
        End If
        If tmp_mois_pose = 10 Then
            temp_mois_pose = "Octobre"
        End If
        If tmp_mois_pose = 11 Then
            temp_mois_pose = "Novembre"
        End If
        If tmp_mois_pose = 12 Then
            temp_mois_pose = "Décembre"
        End If
        End If
     
        'on récupère et teste le mois de dépose
        If Not IsNull(rs("date_demande_depose")) Then
        tmp_mois_depose = Month(rs("date_demande_depose"))
        If tmp_mois_depose = 1 Then
            temp_mois_depose = "Janvier"
        End If
        If tmp_mois_depose = 2 Then
            temp_mois_depose = "Février"
        End If
        If tmp_mois_depose = 3 Then
            temp_mois_depose = "Mars"
        End If
        If tmp_mois_depose = 4 Then
            temp_mois_depose = "Avril"
        End If
        If tmp_mois_depose = 5 Then
            temp_mois_depose = "Mai"
        End If
        If tmp_mois_depose = 6 Then
            temp_mois_depose = "Juin"
        End If
        If tmp_mois_depose = 7 Then
            temp_mois_depose = "Juillet"
        End If
        If tmp_mois_depose = 8 Then
            temp_mois_depose = "Août"
        End If
        If tmp_mois_depose = 9 Then
            temp_mois_depose = "Septembre"
        End If
        If tmp_mois_depose = 10 Then
            temp_mois_depose = "Octobre"
        End If
        If tmp_mois_depose = 11 Then
            temp_mois_depose = "Novembre"
        End If
        If tmp_mois_depose = 12 Then
            temp_mois_depose = "Décembre"
        End If
     
        Annee_depose = Year(rs("date_demande_depose"))
        'Calcul du nombre de jour entre la date de pose et la date de dépose
        Nb_jrs = DateDiff("d", rs("date_pose"), rs("date_demande_depose"))
        If Nb_jrs < 0 Then
        Nb_jrs = 0
        End If
        Else
        Nb_jrs = 0
        End If
     
        'Si le nombre de jours entre la date de pose et la date de dépose est supérieur à 30 jours
        If Nb_jrs > 30 Then
            temp_ech_30 = 1
            temp_loc = 1
        Else
            temp_ech_30 = 0
            temp_loc = 0
        End If
     
        'on récupère le coef d'urgence
        'Si la case est cochée (valeur = -1)
        If rs("coef_K7") = -1 Then
        temp_urgence = 1
        End If
     
        'on récupère la hauteur HPL (hauteur du plancher) --> correspond à la hauteur du garde corps - 1mètre
        If rs("hauteur") > 0 Then
        temp_hpl = rs("hauteur") - 1
        If temp_hpl < "1,5" Then
            temp_hpl = 1
        Else
            temp_hpl = 0
        End If
        Else
            temp_hpl = 0
        End If
     
        'on récupère le produit de la Longueur x Largeur x Hauteur (Volume)
        If (rs("hauteur") > 0 And rs("largeur") > 0 And rs("longueur") > 0) Then
        temp_hauteur = rs("hauteur")
        temp_largeur = rs("largeur")
        temp_longueur = rs("longueur")
        temp_volume = temp_longueur * temp_largeur * temp_hauteur
        If (temp_volume > 1 And temp_volume < 20) Then
            ech_1_20 = 1
        Else
            ech_1_20 = 0
        End If
        If temp_volume > 20 Then
            ech_20 = 1
        Else
            ech_20 = 0
        End If
        End If
     
        'on sélectionne dans la table T_bordereau les informations nécessaires - uniquement pour les avenants "1"
        sql_bordereau = "SELECT * FROM T_Bordereau WHERE numero_bordereau = '" & temp_bordereau & "' and Avenant = 1;"
        Set Bdx = CurrentDb.OpenRecordset(sql_bordereau)
        If Not Bdx.EOF Then
            temp_entreprise = Bdx("nom_entreprise")
            temp_batiment = Bdx("nom_batiment")
        End If
     
        'on récupère la prévenance
        If Not IsNull(Bdx("date_pose")) Then
            If Not IsNull(Bdx("date_demande_pose")) Then
                'Calcul du nombre de jour entre la date de pose et la date de demande de pose (bordereau)
                Nb_jrs_bdx = DateDiff("d", Bdx("date_demande_pose"), Bdx("date_pose"))
                If Nb_jrs_bdx < 0 Then
                    Nb_jrs_bdx = 0
                End If
            Else
                Nb_jrs_bdx = 0
            End If
        Else
            Nb_jrs_bdx = 0
        End If
     
        'Si le nombre de jours entre la date de demande de pose et la date de pose est supérieur à 4 jours
        If Nb_jrs_bdx > 4 Then
            temp_prevenance = 1
        Else
            temp_prevenance = 0
        End If
     
        'On insert les données dans la table T_Synthese
        DoCmd.SetWarnings False
        DoCmd.RunSQL "INSERT INTO T_synthese (numero_bordereau,numero_echafaudage,mois_pose,mois_depose,urgence,entreprise,batiment,annee_pose,annee_depose,Nb_jrs,ech_30,hpl,ech_1_20,ech_20,ech_loc,prevenance) VALUES('" & temp_bordereau & "', '" & temp_echafaudage & "','" & temp_mois_pose & "', '" & temp_mois_depose & "', " & temp_urgence & ", '" & temp_entreprise & "', '" & temp_batiment & "', " & Me.Annee & "," & Annee_depose & ", " & Nb_jrs & ", " & temp_ech_30 & ", '" & temp_hpl & "', '" & ech_1_20 & "', '" & ech_20 & "', '" & temp_loc & "', '" & temp_prevenance & "' );"
     
     
        'on passe à l'enregistrement suivant
        rs.MoveNext
      Wend
     
    End If
     
    rs.Close
    Set rs = Nothing
    '***************************************** T_SYNTHESE END *********************************************************
     
     
     
    '***************************************** T_SYNTH BEGIN ***********************************************************
    sql_synth = "SELECT * FROM T_Synthese ;"
    Set rs_synth = CurrentDb.OpenRecordset(sql_synth)
     
    'Variables mois de pose
    Dim mois_1_p As Integer, mois_2_p As Integer, mois_3_p As Integer, mois_4_p As Integer, mois_5_p As Integer, mois_6_p As Integer, mois_7_p As Integer, mois_8_p As Integer, mois_9_p As Integer, mois_10_p As Integer, mois_11_p As Integer, mois_12_p As Integer
    'Variables mois de dépose
    Dim mois_1_dp As Integer, mois_2_dp As Integer, mois_3_dp As Integer, mois_4_dp As Integer, mois_5_dp As Integer, mois_6_dp As Integer, mois_7_dp As Integer, mois_8_dp As Integer, mois_9_dp As Integer, mois_10_dp As Integer, mois_11_dp As Integer, mois_12_dp As Integer
     
    'Variables texte information
    Dim info1 As String, info2 As String, info3 As String, info4 As String, info5 As String, info6 As String, info7 As String, info8 As String, info9 As String, info10 As String, info11 As String, info12 As String
     
    info1 = "Nb Ech Dém"
    info2 = "Nb Ech Mon"
    info3 = "Nb Urgences"
    info4 = "Taux d'urgence"
    info5 = "Prévenance >= 4j"
    info6 = "Taux de prévenance"
    info7 = "Nb Echaf avec HPL < 1.5m"
    info8 = "Nb Ech entre 1 et 20m3"
    info9 = "Nb Ech > 20m3"
    info10 = "Nb Ech > 30j"
    info11 = "Nb Ech avec Loc"
    info12 = "Durée de vie moyenne"
     
    If Not rs_synth.EOF Then
      'on se positionne sur le premier enregistrement
      rs_synth.MoveFirst
      'On boucle sur chaque enregistrement
      While Not rs_synth.EOF
     
    'Cas mois dépose
        If rs_synth("mois_depose") = "Janvier" Then
            mois_1_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_1_dp & " );"
        End If
        If rs_synth("mois_depose") = "Février" Then
            mois_2_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_2_dp & " );"
        End If
        If rs_synth("mois_depose") = "Mars" Then
            mois_3_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_3_dp & " );"
        End If
        If rs_synth("mois_depose") = "Avril" Then
            mois_4_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_4_dp & " );"
        End If
        If rs_synth("mois_depose") = "Mai" Then
            mois_5_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_5_dp & " );"
        End If
        If rs_synth("mois_depose") = "Juin" Then
            mois_6_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_6_dp & " );"
        End If
        If rs_synth("mois_depose") = "Juillet" Then
            mois_7_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_7_dp & " );"
        End If
        If rs_synth("mois_depose") = "Août" Then
            mois_8_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_8_dp & " );"
        End If
        If rs_synth("mois_depose") = "Septembre" Then
            mois_9_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_9_dp & " );"
        End If
        If rs_synth("mois_depose") = "Octobre" Then
            mois_10_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_10_dp & " );"
        End If
        If rs_synth("mois_depose") = "Novembre" Then
            mois_11_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_11_dp & " );"
        End If
        If rs_synth("mois_depose") = "Décembre" Then
            mois_12_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info1 & "', " & mois_12_dp & " );"
        End If
     
     
     
     
    'Cas mois pose
        If rs_synth("mois_pose") = "Janvier" Then
            mois_1_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_1_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Janvier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Février" Then
            mois_2_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_2_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Fevrier) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Mars" Then
            mois_3_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_3_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mars) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Avril" Then
            mois_4_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_4_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Avril) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Mai" Then
            mois_5_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_5_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Mai) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_depose") = "Juin" Then
            mois_6_dp = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_6_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juin) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Juillet" Then
            mois_7_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_7_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Juillet) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Août" Then
            mois_8_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_8_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Aout) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Septembre" Then
            mois_9_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_9_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Septembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Octobre" Then
            mois_10_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_10_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Octobre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Novembre" Then
            mois_11_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_11_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Novembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
        If rs_synth("mois_pose") = "Décembre" Then
            mois_12_p = 1
            'On insert les données dans la table T_Synth
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info2 & "', " & mois_12_p & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info3 & "', " & rs_synth("urgence") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info5 & "', " & rs_synth("prevenance") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info7 & "', " & rs_synth("Hpl") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info8 & "', " & rs_synth("Ech_1_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info9 & "', " & rs_synth("Ech_20") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info10 & "', " & rs_synth("Ech_30") & " );"
            DoCmd.RunSQL "INSERT INTO T_synth (S_Entreprise,S_batiment,S_information,S_Decembre) VALUES('" & rs_synth("entreprise") & "', '" & rs_synth("batiment") & "','" & info11 & "', " & rs_synth("Ech_loc") & " );"
        End If
     
     
        'on passe à l'enregistrement suivant
        rs_synth.MoveNext
      Wend
     
    End If
     
    rs_synth.Close
    Set rs_synth = Nothing
    '***************************************** T_SYNTHESE END **********************************************************
     
     
     
    End Sub
    d'avance merci de ton aide

    Blado_sap

  15. #15
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap,

    euh pas un cadeau que tu me fais là !

    je pense que tu peux reprendre, trop d'insert dans ta table. Tu peux déjà essayer avec des addnew et update (moins d'accès disque donc plus rapide que des insert).

    Regarde ici :

    http://access.developpez.com/faq/?page=SQL#DiffRstSQL

    jimbolion
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  16. #16
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Jim,

    je sais bien que ce n'est pas un cadeau ce que je te fais là mais c'est pour tester ton expertise en la matière lol

    Blado_sap

  17. #17
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap,

    Merci

    donc essaie en terme de performances les addnew sur recordset... pour tester tes capacités d'adaptation

    jim
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  18. #18
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Merci lol

    mais comment tu spécifies dans ton recordset les champs et valeurs que tu veux passer?

    Blado_sap

  19. #19
    Expert éminent
    Avatar de jimbolion
    Homme Profil pro
    Moulticien
    Inscrit en
    Janvier 2013
    Messages
    3 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Moulticien
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2013
    Messages : 3 150
    Points : 7 001
    Points
    7 001
    Billets dans le blog
    2
    Par défaut
    Blado_sap

    Dans l'idée

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Set rst = CurrentDb.OpenRecordset("T_synth")
    rst .AddNew
    	rst ![S_Entreprise]= rs_synth("entreprise")
    	...
    rst .Update
    jm
    N'oubliez pas le Tag si la réponse donnée vous a été utile et pour une réponse pertinente.
    Retrouvez-moi sur le chat en salon base de données

  20. #20
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    116
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Bas Rhin (Alsace)

    Informations forums :
    Inscription : Juin 2007
    Messages : 116
    Points : 46
    Points
    46
    Par défaut
    Merci Jim,

    pas simple en effet
    surtout avec les lignes ou j'ai plusieurs insert de suite

    dur dur
    un autre coup de main? lol


    et sinon autre question en marge de celle-ci
    dans ma table T_synth j'ai une colonne S_total
    est til possible dans cette colonne que ca me fasse automatiquement la somme de la ligne?

    D'avance merci
    Blado_sap

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

Discussions similaires

  1. Réponses: 4
    Dernier message: 21/08/2013, 14h29
  2. [AC-2007] Requête sélection et fonction SI
    Par Stoo69 dans le forum Requêtes et SQL.
    Réponses: 3
    Dernier message: 04/05/2011, 07h20
  3. [AC-2002] Fonction requête récursive VBA
    Par jobe3141 dans le forum Access
    Réponses: 11
    Dernier message: 24/02/2011, 17h30
  4. [SQL] Élaborer une requête de sélection en fonction d'un formulaire
    Par encore_php dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 22/02/2008, 09h10
  5. Requête de sélection avec fonction "compte"
    Par KEROZEN dans le forum Access
    Réponses: 3
    Dernier message: 25/05/2006, 11h11

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