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 :

Simplification code débutant


Sujet :

VBA Access

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau candidat au Club
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 1
    Par défaut Simplification code débutant
    Bonjour,

    J'ai une application en réseau qui est très ralenti par ce code:
    (je joint une image pour voir les noms de mon code)

    http://www.casimages.com/img.php?i=1...1121337286.png

    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
    Private Sub Commande82_Click()
        DoCmd.SetWarnings False
     
    liste.Requery
    liste.Value = [liste].[ItemData]([liste].[ListCount] - 1)
     
     
    If ID_TRSP.Value <> "" Or ID_FOUR.Value <> "" Then
    If REF_EMBAL.Value <> "" And CMR.Value <> "" And DATE_R.Value <> "" Then
     
     
    If liste.Value <> "" Then
        MsgBox "Cet emballage existe déjà.", vbExclamation, "Attention"
        REF_EMBAL.Value = ""
         Exit Sub
    Else
     
     
    If (Code.Value <> "") Then
     
        reception1.Value = 1
        num.Value = 1
        code_ini.Value = Code.Value
        deconsigne_ini.Value = deconsigne.Value
        consigne_ini.Value = consigne.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
    End If
     
    If (Code1.Value <> "") Then
     
        reception1.Value = 1
        num.Value = 2
        code_ini.Value = Code1.Value
        deconsigne_ini.Value = deconsigne1.Value
        consigne_ini.Value = consigne1.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
    End If
     
    If (Code2.Value <> "") Then
     
        reception1.Value = 1
        num.Value = 3
        code_ini.Value = Code2.Value
        deconsigne_ini.Value = deconsigne2.Value
        consigne_ini.Value = consigne2.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
    End If
     
    If (code3.Value <> "") Then
     
        reception1.Value = 1
        num.Value = 4
        code_ini.Value = code3.Value
        deconsigne_ini.Value = deconsigne3.Value
        consigne_ini.Value = consigne3.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
    End If
     
    If (code4.Value <> "") Then
        reception1.Value = 1
        num.Value = 5
        code_ini.Value = code4.Value
        deconsigne_ini.Value = deconsigne4.Value
        consigne_ini.Value = consigne4.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
     
      If (code5.Value <> "") Then
        reception1.Value = 1
        num.Value = 6
        code_ini.Value = code5.Value
        deconsigne_ini.Value = deconsigne5.Value
        consigne_ini.Value = consigne5.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
     
      If (code6.Value <> "") Then
        reception1.Value = 1
        num.Value = 7
        code_ini.Value = code6.Value
        deconsigne_ini.Value = deconsigne6.Value
        consigne_ini.Value = consigne6.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
     
      If (code7.Value <> "") Then
        reception1.Value = 1
        num.Value = 8
        code_ini.Value = code7.Value
        deconsigne_ini.Value = deconsigne7.Value
        consigne_ini.Value = consigne7.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
     
      If (code8.Value <> "") Then
        reception1.Value = 1
        num.Value = 9
        code_ini.Value = code8.Value
        deconsigne_ini.Value = deconsigne8.Value
        consigne_ini.Value = consigne8.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
     
      If (code9.Value <> "") Then
        reception1.Value = 1
        num.Value = 10
        code_ini.Value = code9.Value
        deconsigne_ini.Value = deconsigne9.Value
        consigne_ini.Value = consigne9.Value
    DoCmd.RunSQL "insert into reception (MAJ_REC,UTIL_REC,TRSP_REC,FOUR_REC,DATE_REC,BON_REC,CMR_REC,NUM_REC,EMBAL_REC,DEC_REC,CON_REC,ETAT_REC)values(now(),currentuser(),ID_TRSP,ID_FOUR,DATE_R,REF_EMBAL,CMR,num,code_ini,nz(deconsigne_ini,0),nz(consigne_ini,0),reception1)", -1
     
      End If
        Me![ID_TRSP].SetFocus
        'MsgBox ("Enregistrement réussi!!!")
    End If
    Else: MsgBox "Enregistrement Annulé: un champ est vide", vbExclamation, "Attention"
    Me![DATE_R].SetFocus
    Exit Sub
    End If
    Else: MsgBox "Enregistrement Annulé: champ transporteur ou fournisseur vide", vbExclamation, "Attention"
    Me![ID_TRSP].SetFocus
    Exit Sub
    End If
     DoCmd.Close acForm, "RECEPTION"
     DoCmd.OpenForm "RECEPTION", acNormal, , , acFormAdd
    End Sub
    J'aimerais savoir si il y avait pas une simplification pour accélérer l'insertion qui est très lente sur le réseau de l'ordre de 30s sachant que de nombreux enregistrements sont effectués sur cet écran. Par plusieurs utilisateurs en même temps

    et je ne parle d'un autre écran qui permet la modification de saisie qui est de l'ordre d'1min, mais qui ressemble à celui-ci, j'espère du coup m'en inspirer si une solution existe , merci d'avance pour les réponse

  2. #2
    Rédacteur/Modérateur
    Avatar de loufab
    Homme Profil pro
    Entrepreneur en solutions informatiques viables et fonctionnelles.
    Inscrit en
    Avril 2005
    Messages
    12 148
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Entrepreneur en solutions informatiques viables et fonctionnelles.
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2005
    Messages : 12 148
    Par défaut
    Bonjour,
    Le problème n'étant pas propre à ce code (tu as des problèmes de lenteur sur un autre formulaire) je pense que ton problème est général.

    Il y a un tuto sur l'optimisation des bases de données.

    http://loufab.developpez.com/tutorie.../optimisation/

    A consulter en priorité.

    Cordialement,

Discussions similaires

  1. Correction de mon code [Débutant]
    Par Calvein dans le forum C#
    Réponses: 12
    Dernier message: 13/06/2008, 07h28
  2. petit pb de code, (débutante en informatique)
    Par elise69 dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 22/07/2007, 20h26
  3. [XSLT] Erreur partielle - Simplification Code ?
    Par Sam 069 dans le forum XSL/XSLT/XPATH
    Réponses: 6
    Dernier message: 13/04/2007, 11h45
  4. Soucis CODE (Débutant)
    Par matt8-5 dans le forum Langage
    Réponses: 4
    Dernier message: 09/06/2006, 10h10
  5. Xsl problème d'affichage (code) [débutant]
    Par redsaint dans le forum XSL/XSLT/XPATH
    Réponses: 13
    Dernier message: 01/06/2005, 17h02

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