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 :

Utilisation incorrect de Null


Sujet :

VBA Access

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut Utilisation incorrect de Null
    Bonsoir a tous et au forum
    étant nouveau et comme je début en Access
    voici mon probleme :
    que je lance mon fichier j'ai ce message :
    "Utilisation incorrect de Null"
    Mon fichier sue un PC avec Windows XP (access 2003) fonctionne et quand je bascule sur win 7 ou win 10 (access 2007 ou access 2003) j'ai ce message, bizarre

    Grand Merci pour votre aide, voici son code :

    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
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenRecordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
     
        chaine_esp = r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![id] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![position] = pos_cpt
     
        r_table![id] = r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(r_table![prix], "###0.00")
     
        If IsNull(r_table![prix]) Or r_table![prix] <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If IsNull(r_table![qte]) Or r_table![qte] <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = r_table![Description]
    '        'ajout 21_12_09
    '        chaine_esp = Replace(chaine_esp, "Réunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "Reunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "reunion", "r-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "union", "u-n-i-o-n")
    '
    '        chaine_esp = Replace(chaine_esp, "cascade", "c-a-s-c-a-d-e")
    '        chaine_esp = Replace(chaine_esp, "Cascade", "C-a-s-c-a-d-e")
     
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub

  2. #2
    Membre émérite Avatar de Zekraoui_Jakani
    Homme Profil pro
    Inscrit en
    Novembre 2013
    Messages
    1 670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2013
    Messages : 1 670
    Points : 2 489
    Points
    2 489
    Par défaut
    1) Conseil général, pour insérer un code dans tes messages, il faut utiliser la balise "Code" (c'est l'icône '#' dans l'éditeur de texte).
    2) Pour ta question, je te conseille de lancer ton code de façon séquentielle: mettre le curseur n'importe où dans le code et presser F8 pour une exécution ligne par ligne jusqu'à ce que tu trouves la ligne incriminée qui contient le champs posant problème. Tu pourras dès lors agir en conséquence.

  3. #3
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    Tu serais bien avisé si tu précisais à quelle ligne ce trouve l'erreur!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    chaine_esp = "" & r_table![Designation_famille] 'Vba a peur de ce qui est nulle!

  4. #4
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonjour, et merci pour vos réponses
    je suis novice pardonné moi


    Merci pour votre aide

  5. #5
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    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
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenRecordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![ID] = cpt
     
        chaine_esp = "" & r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = "" & r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = "" & r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = "" & r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = "" & r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![ID] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![ID] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = "" & r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![Position] = pos_cpt
     
        r_table![ID] = "" & r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(Replace(Val("" & r_table![prix], ",", ".")), "###0.00")
     
        If Val(Replace("" & r_table![prix], ",", ".")) <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If Val(Replace("" & r_table![qte], ",", ".")) <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = "" & r_table![Description]
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = "" & r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = "" & r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = "" & r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = "" & r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = "" & r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If "" & r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub

  6. #6
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Merci pour votre reponse, j'ai mis le code
    mais j'ai une erreur exécution 3151
    a la ligne :
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)

    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
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    Private Sub Form_Close()
    DoCmd.SetWarnings True
    End Sub
     
    Private Sub Form_Load()
    DoCmd.SetWarnings False
    Me.TimerInterval = 10000
    End Sub
     
    Private Sub Form_Timer()
     
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "dom_ps_zone"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    r_table_1.MoveFirst
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    End Sub
    Private Sub maj_donnees_Click()
    On Error GoTo Err_maj_donnees_Click
     
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    'Dim cpt
    Dim sql As String
    'virifier si le Dom à bien vider les tables !!!
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "dom_ps_category_product"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    If r_table_1.BOF = False Then
        MsgBox "Il faut vider les tables dans l'admin de la boutique !"
        Set r_table_1 = Nothing
        Set bds_1 = Nothing
        Exit Sub
    End If
     
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    '
    '
    'Me![info] = "Supression catégories textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_lang_sup_distant" 'vide cat distant
    '
    'Me![info] = "Supression catégories"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_sup_distant" 'vide cat designation distant
    '
    'Me![info] = "Supression fabricants"
    'Me.Repaint
    'DoCmd.OpenQuery "r_fab_sup_distant" 'vide fab serveur
    '
    'Me![info] = "Supression articles"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_sup_distant" 'vide donnees ref distant
    '
    'Me![info] = "Supression articles textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_lang_sup_distant" 'vide donnees ref lang distant
    '
    ''requete à problème
    '
    ''Me![info] = "1"
    ''Me.Repaint
    ''DoCmd.OpenQuery "r_ref_cat_sup_distant"
     
    'mise à jour ------------------------------------------------------------
     
    'Select Case choix_maj
    '    Case 1
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '    Case 2
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '    Case 3
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '    Case 4
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '    Case 5
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '    Case 6
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '
    '
    '    Case 7
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '    Case Else
    '        Me![info] = "Fin !"
    '        Me.Repaint
    'End Select
     
     
     
     
     
            Me![info] = "Mise à jour catégories"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_maj_distant"
     
            Me![info] = "Mise à jour catégories textes"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_lang_maj_distant"
     
            Me![info] = "Mise à jour fabricants"
            Me.Repaint
            DoCmd.OpenQuery "r_fab_maj_distant"
     
            Me![info] = "Mise à jour articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_distant"
     
            Me![info] = "Mise à jour articles textes"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_lang_distant"
     
            Me![info] = "Mise à jour liasons categories articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_cat_maj_distant"
            Me![info] = "Fin !"
            Me.Repaint
    Exit_maj_donnees_Click:
        Exit Sub
     
    Err_maj_donnees_Click:
        MsgBox Err.Description
        Resume Exit_maj_donnees_Click
     
    End Sub
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenRecordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
     
        chaine_esp = r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![id] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![position] = pos_cpt
     
        r_table![id] = r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(r_table![prix], "###0.00")
     
        If IsNull(r_table![prix]) Or r_table![prix] <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If IsNull(r_table![qte]) Or r_table![qte] <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = r_table![Description]
    '        'ajout 21_12_09
    '        chaine_esp = Replace(chaine_esp, "Réunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "Reunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "reunion", "r-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "union", "u-n-i-o-n")
    '
    '        chaine_esp = Replace(chaine_esp, "cascade", "c-a-s-c-a-d-e")
    '        chaine_esp = Replace(chaine_esp, "Cascade", "C-a-s-c-a-d-e")
     
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub
    Private Sub sauve_donnees_images_Click()
    On Error GoTo Err_sauve_donnees_images_Click
    Dim sql As String
    sql = "DELETE t_images.* FROM t_images;"
    DoCmd.RunSQL sql
     
    sql = "DELETE t_images_lang.* FROM t_images_lang;"
    DoCmd.RunSQL sql
     
    sql = "INSERT INTO t_images ( id_image, id_product, [position], cover ) " & _
    "SELECT dom_ps_image.id_image, dom_ps_image.id_product, dom_ps_image.position, dom_ps_image.cover " & _
    "FROM dom_ps_image;"
    DoCmd.RunSQL sql
     
     
    sql = "INSERT INTO t_images_lang ( id_image, id_lang, legend ) " & _
    "SELECT dom_ps_image_lang.id_image, dom_ps_image_lang.id_lang, dom_ps_image_lang.legend " & _
    "FROM dom_ps_image_lang;"
    DoCmd.RunSQL sql
     
    Exit_sauve_donnees_images_Click:
        Exit Sub
     
    Err_sauve_donnees_images_Click:
        MsgBox Err.Description
        Resume Exit_sauve_donnees_images_Click
     
    End Sub
    Private Sub Commande31_Click()
    On Error GoTo Err_Commande31_Click
     
     
        DoCmd.OpenQuery "r_cpt_img"
     
    Exit_Commande31_Click:
        Exit Sub
     
    Err_Commande31_Click:
        MsgBox Err.Description
        Resume Exit_Commande31_Click
     
    End Sub

  7. #7
    Invité
    Invité(e)
    Par défaut
    Désolé j'avais pas vu!
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    table_1 = "select * from dom_ps_category_product"

  8. #8
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonsoir, avec les modif
    cette fois rien ne ce passe ?
    pas de message patience ....lorsque je lance la préparation local



    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
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    Private Sub Form_Close()
    DoCmd.SetWarnings True
    End Sub
     
    Private Sub Form_Load()
    DoCmd.SetWarnings False
    Me.TimerInterval = 10000
    End Sub
     
    Private Sub Form_Timer()
     
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "dom_ps_zone"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    r_table_1.MoveFirst
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    End Sub
    Private Sub maj_donnees_Click()
    On Error GoTo Err_maj_donnees_Click
     
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    'Dim cpt
    Dim sql As String
    'virifier si le Dom à bien vider les tables !!!
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "select * from dom_ps_category_product"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    If r_table_1.BOF = False Then
        MsgBox "Il faut vider les tables dans l'admin de la boutique !"
        Set r_table_1 = Nothing
        Set bds_1 = Nothing
        Exit Sub
    End If
     
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    '
    '
    'Me![info] = "Supression catégories textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_lang_sup_distant" 'vide cat distant
    '
    'Me![info] = "Supression catégories"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_sup_distant" 'vide cat designation distant
    '
    'Me![info] = "Supression fabricants"
    'Me.Repaint
    'DoCmd.OpenQuery "r_fab_sup_distant" 'vide fab serveur
    '
    'Me![info] = "Supression articles"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_sup_distant" 'vide donnees ref distant
    '
    'Me![info] = "Supression articles textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_lang_sup_distant" 'vide donnees ref lang distant
    '
    ''requete à problème
    '
    ''Me![info] = "1"
    ''Me.Repaint
    ''DoCmd.OpenQuery "r_ref_cat_sup_distant"
     
    'mise à jour ------------------------------------------------------------
     
    'Select Case choix_maj
    '    Case 1
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '    Case 2
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '    Case 3
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '    Case 4
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '    Case 5
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '    Case 6
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '
    '
    '    Case 7
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '    Case Else
    '        Me![info] = "Fin !"
    '        Me.Repaint
    'End Select
     
     
     
     
     
            Me![info] = "Mise à jour catégories"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_maj_distant"
     
            Me![info] = "Mise à jour catégories textes"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_lang_maj_distant"
     
            Me![info] = "Mise à jour fabricants"
            Me.Repaint
            DoCmd.OpenQuery "r_fab_maj_distant"
     
            Me![info] = "Mise à jour articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_distant"
     
            Me![info] = "Mise à jour articles textes"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_lang_distant"
     
            Me![info] = "Mise à jour liasons categories articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_cat_maj_distant"
            Me![info] = "Fin !"
            Me.Repaint
    Exit_maj_donnees_Click:
        Exit Sub
     
    Err_maj_donnees_Click:
        MsgBox Err.Description
        Resume Exit_maj_donnees_Click
     
    End Sub
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenRecordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
     
        chaine_esp = r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![id] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![position] = pos_cpt
     
        r_table![id] = r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(r_table![prix], "###0.00")
     
        If IsNull(r_table![prix]) Or r_table![prix] <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If IsNull(r_table![qte]) Or r_table![qte] <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = r_table![Description]
    '        'ajout 21_12_09
    '        chaine_esp = Replace(chaine_esp, "Réunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "Reunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "reunion", "r-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "union", "u-n-i-o-n")
    '
    '        chaine_esp = Replace(chaine_esp, "cascade", "c-a-s-c-a-d-e")
    '        chaine_esp = Replace(chaine_esp, "Cascade", "C-a-s-c-a-d-e")
     
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub
    Private Sub sauve_donnees_images_Click()
    On Error GoTo Err_sauve_donnees_images_Click
    Dim sql As String
    sql = "DELETE t_images.* FROM t_images;"
    DoCmd.RunSQL sql
     
    sql = "DELETE t_images_lang.* FROM t_images_lang;"
    DoCmd.RunSQL sql
     
    sql = "INSERT INTO t_images ( id_image, id_product, [position], cover ) " & _
    "SELECT dom_ps_image.id_image, dom_ps_image.id_product, dom_ps_image.position, dom_ps_image.cover " & _
    "FROM dom_ps_image;"
    DoCmd.RunSQL sql
     
     
    sql = "INSERT INTO t_images_lang ( id_image, id_lang, legend ) " & _
    "SELECT dom_ps_image_lang.id_image, dom_ps_image_lang.id_lang, dom_ps_image_lang.legend " & _
    "FROM dom_ps_image_lang;"
    DoCmd.RunSQL sql
     
    Exit_sauve_donnees_images_Click:
        Exit Sub
     
    Err_sauve_donnees_images_Click:
        MsgBox Err.Description
        Resume Exit_sauve_donnees_images_Click
     
    End Sub
    Private Sub Commande31_Click()
    On Error GoTo Err_Commande31_Click
     
     
        DoCmd.OpenQuery "r_cpt_img"
     
    Exit_Commande31_Click:
        Exit Sub
     
    Err_Commande31_Click:
        MsgBox Err.Description
        Resume Exit_Commande31_Click
     
    End Sub

  9. #9
    Invité
    Invité(e)
    Par défaut
    Mets cette ligne en commentaire!
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    'On Error GoTo Err_maj_donnees_Click

  10. #10
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonjour a tous,
    Ce commentaire je le met a la fin de ma procedure preparation local ou tout a la fin de ma page ?
    Merci

  11. #11
    Invité
    Invité(e)
    Par défaut
    bonjour,
    non à l'endroit ou ce trouve l'instruction

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Private Sub maj_donnees_Click()
    'On Error GoTo Err_maj_donnees_Click
    il ne faut jamais mettre de on error surtout si on tu sais pas les gérer! une erreur est préférable à un comportement bizarroïde!

  12. #12
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Merci pour ta reponse je regarde ce soir et te tiens au courant.

  13. #13
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonsoir, malheureusement j'ai toujours une erreur

    Erreur d'exécution 3151
    ODB - echec de la connexion à "marsouin"
    Et toujours avec la ligne en jaune :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    merci pour ton aide

  14. #14
    Expert confirmé

    Homme Profil pro
    consultant développeur
    Inscrit en
    Mai 2005
    Messages
    2 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : consultant développeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 878
    Points : 4 754
    Points
    4 754
    Par défaut
    Bonsoir,
    il faut désormais typer les database et les recordset, donc :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ...
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As DAO.Database
    Dim table As String
    Dim r_table As DAO.Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    ...
    Cdlt
    "Always look at the bright side of life." Monty Python.

  15. #15
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonsoir, je n'ai pas tous saisie
    mais voici le nouveau code suivant vos conseils :

    Mais c'est toujours pas bon

    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
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    Option Compare Database
     
    Private Sub Form_Close()
    DoCmd.SetWarnings True
    End Sub
     
    Private Sub Form_Load()
    DoCmd.SetWarnings False
    Me.TimerInterval = 10000
    End Sub
     
    Private Sub Form_Timer()
     
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "dom_ps_zone"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    r_table_1.MoveFirst
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    End Sub
    Private Sub maj_donnees_Click()
     'On Error GoTo Err_maj_donnees_Click
     
     
    Dim bds As Database
    Dim table As String
    Dim r_table As Recordset
    'Dim cpt
    Dim sql As String
    'virifier si le Dom à bien vider les tables !!!
    Dim bds_1 As Database
    Dim table_1 As String
    Dim r_table_1 As Recordset
    Set bds_1 = CurrentDb
    table_1 = "select * from dom_ps_category_product"
    Set r_table_1 = bds_1.OpenRecordset(table_1, dbOpenDynaset)
    If r_table_1.BOF = False Then
        MsgBox "Il faut vider les tables dans l'admin de la boutique !"
        Set r_table_1 = Nothing
        Set bds_1 = Nothing
        Exit Sub
    End If
     
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    '
    '
    'Me![info] = "Supression catégories textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_lang_sup_distant" 'vide cat distant
    '
    'Me![info] = "Supression catégories"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_sup_distant" 'vide cat designation distant
    '
    'Me![info] = "Supression fabricants"
    'Me.Repaint
    'DoCmd.OpenQuery "r_fab_sup_distant" 'vide fab serveur
    '
    'Me![info] = "Supression articles"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_sup_distant" 'vide donnees ref distant
    '
    'Me![info] = "Supression articles textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_lang_sup_distant" 'vide donnees ref lang distant
    '
    ''requete à problème
    '
    ''Me![info] = "1"
    ''Me.Repaint
    ''DoCmd.OpenQuery "r_ref_cat_sup_distant"
     
    'mise à jour ------------------------------------------------------------
     
    'Select Case choix_maj
    '    Case 1
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '    Case 2
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '    Case 3
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '    Case 4
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '    Case 5
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '    Case 6
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '
    '
    '    Case 7
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '    Case Else
    '        Me![info] = "Fin !"
    '        Me.Repaint
    'End Select
     
     
     
     
     
            Me![info] = "Mise à jour catégories"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_maj_distant"
     
            Me![info] = "Mise à jour catégories textes"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_lang_maj_distant"
     
            Me![info] = "Mise à jour fabricants"
            Me.Repaint
            DoCmd.OpenQuery "r_fab_maj_distant"
     
            Me![info] = "Mise à jour articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_distant"
     
            Me![info] = "Mise à jour articles textes"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_lang_distant"
     
            Me![info] = "Mise à jour liasons categories articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_cat_maj_distant"
            Me![info] = "Fin !"
            Me.Repaint
    Exit_maj_donnees_Click:
        Exit Sub
     
    Err_maj_donnees_Click:
        MsgBox Err.Description
        Resume Exit_maj_donnees_Click
     
    End Sub
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As DAO.Database
    Dim table As String
    Dim r_table As DAO.Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenRecordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
     
        chaine_esp = r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![id] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenRecordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![position] = pos_cpt
     
        r_table![id] = r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(r_table![prix], "###0.00")
     
        If IsNull(r_table![prix]) Or r_table![prix] <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If IsNull(r_table![qte]) Or r_table![qte] <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = r_table![Description]
    '        'ajout 21_12_09
    '        chaine_esp = Replace(chaine_esp, "Réunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "Reunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "reunion", "r-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "union", "u-n-i-o-n")
    '
    '        chaine_esp = Replace(chaine_esp, "cascade", "c-a-s-c-a-d-e")
    '        chaine_esp = Replace(chaine_esp, "Cascade", "C-a-s-c-a-d-e")
     
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub
    Private Sub sauve_donnees_images_Click()
    On Error GoTo Err_sauve_donnees_images_Click
    Dim sql As String
    sql = "DELETE t_images.* FROM t_images;"
    DoCmd.RunSQL sql
     
    sql = "DELETE t_images_lang.* FROM t_images_lang;"
    DoCmd.RunSQL sql
     
    sql = "INSERT INTO t_images ( id_image, id_product, [position], cover ) " & _
    "SELECT dom_ps_image.id_image, dom_ps_image.id_product, dom_ps_image.position, dom_ps_image.cover " & _
    "FROM dom_ps_image;"
    DoCmd.RunSQL sql
     
     
    sql = "INSERT INTO t_images_lang ( id_image, id_lang, legend ) " & _
    "SELECT dom_ps_image_lang.id_image, dom_ps_image_lang.id_lang, dom_ps_image_lang.legend " & _
    "FROM dom_ps_image_lang;"
    DoCmd.RunSQL sql
     
    Exit_sauve_donnees_images_Click:
        Exit Sub
     
    Err_sauve_donnees_images_Click:
        MsgBox Err.Description
        Resume Exit_sauve_donnees_images_Click
     
    End Sub
    Private Sub Commande31_Click()
    On Error GoTo Err_Commande31_Click
     
     
        DoCmd.OpenQuery "r_cpt_img"
     
    Exit_Commande31_Click:
        Exit Sub
     
    Err_Commande31_Click:
        MsgBox Err.Description
        Resume Exit_Commande31_Click
     
    End Sub

  16. #16
    Expert confirmé

    Homme Profil pro
    consultant développeur
    Inscrit en
    Mai 2005
    Messages
    2 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : consultant développeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 878
    Points : 4 754
    Points
    4 754
    Par défaut
    en plus clair, depuis Access 2007, il faut préciser pour les objets database et Recordset si on utilise les bibliothèques DAO et ADO
    Dans ton cas il faut préciser .DAO dans toutes les déclarations ( Dim .. as database, Dim ... as recordset)

    donc il te faire cette modif aussi dans Form_timer() ...

    Après si ça plante toujours, dis-nous sur quelle ligne.

    Cdlt
    "Always look at the bright side of life." Monty Python.

  17. #17
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonsoir
    voila j'ai essayé de faire ce que tu ma conseillé :

    Quand je lance ma preparation local rien ne ce passe....
    je n'ai plus mon petit message que me dit patience

    I'm lost

    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
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    Private Sub Form_Close()
    DoCmd.SetWarnings True
    End Sub
     
    Private Sub Form_Load()
    DoCmd.SetWarnings False
    Me.TimerInterval = 10000
    End Sub
     
    Private Sub Form_Timer()
     
    Dim bds_1 As DAO.Database
    Dim table_1 As String
    Dim r_table_1 As DAO.Recordset
    Set bds_1 = CurrentDb
    table_1 = "dom_ps_zone"
    Set r_table_1 = bds_1.OpenDAO.Recordset(table_1, dbOpenDynaset)
    r_table_1.MoveFirst
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    End Sub
    Private Sub maj_donnees_Click()
     'On Error GoTo Err_maj_donnees_Click
     
     
    Dim bds As DAO.Database
    Dim table As String
    Dim r_table As DAO.Recordset
    'Dim cpt
    Dim sql As String
    'virifier si le Dom à bien vider les tables !!!
    Dim bds_1 As DAO.Database
    Dim table_1 As String
    Dim r_table_1 As DAO.Recordset
    Set bds_1 = CurrentDb
    table_1 = "select * from dom_ps_category_product"
    Set r_table_1 = bds_1.OpenDAO.Recordset(table_1, dbOpenDynaset)
    If r_table_1.BOF = False Then
        MsgBox "Il faut vider les tables dans l'admin de la boutique !"
        Set r_table_1 = Nothing
        Set bds_1 = Nothing
        Exit Sub
    End If
     
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
     
     
    '
    '
    'Me![info] = "Supression catégories textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_lang_sup_distant" 'vide cat distant
    '
    'Me![info] = "Supression catégories"
    'Me.Repaint
    'DoCmd.OpenQuery "r_cat_sup_distant" 'vide cat designation distant
    '
    'Me![info] = "Supression fabricants"
    'Me.Repaint
    'DoCmd.OpenQuery "r_fab_sup_distant" 'vide fab serveur
    '
    'Me![info] = "Supression articles"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_sup_distant" 'vide donnees ref distant
    '
    'Me![info] = "Supression articles textes"
    'Me.Repaint
    'DoCmd.OpenQuery "r_ref_lang_sup_distant" 'vide donnees ref lang distant
    '
    ''requete à problème
    '
    ''Me![info] = "1"
    ''Me.Repaint
    ''DoCmd.OpenQuery "r_ref_cat_sup_distant"
     
    'mise à jour ------------------------------------------------------------
     
    'Select Case choix_maj
    '    Case 1
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '    Case 2
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '    Case 3
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '    Case 4
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '    Case 5
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '    Case 6
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '
    '
    '    Case 7
    '        Me![info] = "Mise à jour catégories"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_maj_distant"
    '
    '        Me![info] = "Mise à jour catégories textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_cat_lang_maj_distant"
    '
    '        Me![info] = "Mise à jour fabricants"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_fab_maj_distant"
    '
    '        Me![info] = "Mise à jour articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_distant"
    '
    '        Me![info] = "Mise à jour articles textes"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_maj_lang_distant"
    '
    '        Me![info] = "Mise à jour liasons categories articles"
    '        Me.Repaint
    '        DoCmd.OpenQuery "r_ref_cat_maj_distant"
    '
    '    Case Else
    '        Me![info] = "Fin !"
    '        Me.Repaint
    'End Select
     
     
     
     
     
            Me![info] = "Mise à jour catégories"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_maj_distant"
     
            Me![info] = "Mise à jour catégories textes"
            Me.Repaint
            DoCmd.OpenQuery "r_cat_lang_maj_distant"
     
            Me![info] = "Mise à jour fabricants"
            Me.Repaint
            DoCmd.OpenQuery "r_fab_maj_distant"
     
            Me![info] = "Mise à jour articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_distant"
     
            Me![info] = "Mise à jour articles textes"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_maj_lang_distant"
     
            Me![info] = "Mise à jour liasons categories articles"
            Me.Repaint
            DoCmd.OpenQuery "r_ref_cat_maj_distant"
            Me![info] = "Fin !"
            Me.Repaint
    Exit_maj_donnees_Click:
        Exit Sub
     
    Err_maj_donnees_Click:
        MsgBox Err.Description
        Resume Exit_maj_donnees_Click
     
    End Sub
    Private Sub preparation_locale_Click()
    On Error GoTo Err_preparation_locale_Click
    Dim bds As DAO.Database
    Dim table As String
    Dim r_table As DAO.Recordset
    Dim cpt
    Dim chaine_esp As String
    Dim chaine_rec As String
    Dim chaine_tmp As String
    Dim sql As String
    Dim i
     
    sql = "SELECT First(references.REFERENCE) AS REFERENCEChamps, Count(references.REFERENCE) AS NombreDeDbls " & _
    "FROM [References] " & _
    "GROUP BY references.REFERENCE " & _
    "HAVING (((Count(references.REFERENCE))>1));"
    Set bds = CurrentDb
    Set r_table = bds.OpenDAO.Recordset(sql, dbOpenDynaset)
     
    If r_table.EOF = False Then
        MsgBox "Dom, tu as des doublons !!!"
        Set r_table = Nothing
        Set bds = Nothing
        Exit Sub
    End If
    Set r_table = Nothing
    Set bds = Nothing
     
     
    Me![info] = "Patience ..."
    Me.Repaint
    'local
    DoCmd.OpenQuery "r_cat_conversion_sup" 'vide table cat locale
    DoCmd.OpenQuery "r_fab_sup" 'vide fabricants
    DoCmd.OpenQuery "r_ref_sup" 'sup donnees ref locales
     
    DoCmd.OpenQuery "r_cat_conversion" 'ajout des données SANS ID
    DoCmd.OpenQuery "r_fab_maj" 'ajout données SANS ID
     
     
    'mise à jour de l'id cat
    Set bds = CurrentDb
    table = "t_famille_conversion"
    Set r_table = bds.OpenDAO.Recordset(table, dbOpenDynaset)
     
    cpt = 2
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
     
        chaine_esp = r_table![Designation_famille]
     
        chaine_esp = Replace(chaine_esp, "          ", " ")
        chaine_esp = Replace(chaine_esp, "         ", " ")
        chaine_esp = Replace(chaine_esp, "        ", " ")
        chaine_esp = Replace(chaine_esp, "       ", " ")
        chaine_esp = Replace(chaine_esp, "      ", " ")
        chaine_esp = Replace(chaine_esp, "     ", " ")
        chaine_esp = Replace(chaine_esp, "    ", " ")
        chaine_esp = Replace(chaine_esp, "   ", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![Designation_famille] = chaine_esp
     
        ' creation lien
     
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, "°", "-")
        chaine_esp = Replace(chaine_esp, " ", "-")
        chaine_esp = Replace(chaine_esp, "é", "e")
        chaine_esp = Replace(chaine_esp, "è", "e")
        chaine_esp = Replace(chaine_esp, "ê", "e")
        chaine_esp = Replace(chaine_esp, "à", "a")
        chaine_esp = Replace(chaine_esp, "ô", "o")
        chaine_esp = Replace(chaine_esp, "ç", "c")
        chaine_esp = Replace(chaine_esp, "/", "-")
        chaine_esp = Replace(chaine_esp, ",", "-")
        chaine_esp = Replace(chaine_esp, ".", "-")
        chaine_esp = Replace(chaine_esp, "'", "-")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "---", "-")
        chaine_esp = Replace(chaine_esp, "--", "-")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
        chaine_esp = LCase(chaine_esp)
        r_table![link_rewrite] = chaine_esp
     
        ' creation meta_desc
        chaine_esp = r_table![Designation_famille]
        chaine_esp = Replace(chaine_esp, " , ", ", ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        r_table![meta_description] = chaine_esp
     
        'titre
        r_table![meta_title] = r_table![meta_description]
     
        ' mots clé
        r_table![meta_keywords] = r_table![Designation_famille]
        chaine_esp = r_table![meta_keywords]
        chaine_esp = Replace(chaine_esp, ".", " ")
        chaine_esp = Replace(chaine_esp, ",", " ")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, " / ", "/")
        chaine_esp = Replace(chaine_esp, " , ", " ")
        chaine_esp = Replace(chaine_esp, " ", ", ")
     
        chaine_esp = Replace(chaine_esp, " à, ", "")
        chaine_esp = Replace(chaine_esp, " et, ", "")
        chaine_esp = Replace(chaine_esp, " de, ", "")
        chaine_esp = Replace(chaine_esp, " du, ", "")
        chaine_esp = Replace(chaine_esp, " des, ", "")
        chaine_esp = Replace(chaine_esp, " au, ", "")
        chaine_esp = Replace(chaine_esp, " je, ", "")
        chaine_esp = Replace(chaine_esp, " en, ", "")
        chaine_esp = Replace(chaine_esp, " d', ", "")
        chaine_esp = Replace(chaine_esp, " n°, ", "")
        chaine_esp = Replace(chaine_esp, " tout, ", "")
        chaine_esp = Replace(chaine_esp, " avec, ", "")
        chaine_esp = Replace(chaine_esp, " sans, ", "")
     
        chaine_esp = Replace(chaine_esp, " ex, ", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, "(", "")
        chaine_esp = Replace(chaine_esp, ")", "")
        chaine_esp = Replace(chaine_esp, " réf, ", "")
        chaine_esp = Replace(chaine_esp, ",", ", ")
        chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
        chaine_esp = Replace(chaine_esp, " j'en, ", "")
        chaine_esp = Replace(chaine_esp, " suis, ", "")
        chaine_esp = Replace(chaine_esp, """", "")
        chaine_esp = Replace(chaine_esp, "  ", " ")
        chaine_esp = Replace(chaine_esp, "§", "s")
        ' ajout le 21_12_09
        chaine_esp = Replace(chaine_esp, "Ö", "O")
        chaine_esp = Replace(chaine_esp, "ö", "o")
        chaine_esp = Replace(chaine_esp, "Ü", "U")
        chaine_esp = Replace(chaine_esp, "ü", "u")
        ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
     
     
     
        chaine_esp = LCase(chaine_esp)
     
        r_table![meta_keywords] = chaine_esp
     
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
     
    Loop
     
    'famille pour tous les articles. Famille non active
        r_table.AddNew
     
        r_table![Code_famille] = "marc"
        r_table![Designation_famille] = "Tous les articles"
        r_table![id] = 1000
        For i = 3 To 6
            r_table.Fields(i) = "neant"
        Next i
        r_table.Update
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    'mise à jour de l'id fab
    'Set bds = CurrentDb
    table = "t_fabricants"
    Set r_table = bds.OpenDAO.Recordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveFirst
     
    Do While Not r_table.EOF
        r_table.Edit
        r_table![id] = cpt
        r_table.Update
        r_table.MoveNext
        cpt = cpt + 1
    Loop
     
    Set r_table = Nothing
    'Set bds = Nothing
     
    DoCmd.OpenQuery "r_ref_maj" 'ajout donnees locales SANS ID
     
    'mise à jour de l'id ref plus ID
    'Set bds = CurrentDb
    table = "t_references_conversion"
    Set r_table = bds.OpenDAO.Recordset(table, dbOpenDynaset)
     
    cpt = 1
    r_table.MoveLast
    r_table.MoveFirst
     
    pos_tmp = r_table![famille]
    pos_cpt = 1
    Do While Not r_table.EOF
        r_table.Edit
        r_table![position] = pos_cpt
     
        r_table![id] = r_table![Reference]
        ' prix renseignés ou pas
     
        If IsNull(r_table![prix]) Then
            r_table![prix] = 0
        End If
     
        r_table![prix] = Format(r_table![prix], "###0.00")
     
        If IsNull(r_table![prix]) Or r_table![prix] <= 0 Then
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
        ' chercher qte 0
        If IsNull(r_table![qte]) Or r_table![qte] <= 0 Then
            r_table![qte] = 0
     
            r_table![actif] = 0
        Else
            r_table![actif] = 1
        End If
     
     
        ' creation lien
            chaine_esp = r_table![Description]
    '        'ajout 21_12_09
    '        chaine_esp = Replace(chaine_esp, "Réunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "Reunion", "R-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "reunion", "r-e-u-n-i-o-n")
    '        chaine_esp = Replace(chaine_esp, "union", "u-n-i-o-n")
    '
    '        chaine_esp = Replace(chaine_esp, "cascade", "c-a-s-c-a-d-e")
    '        chaine_esp = Replace(chaine_esp, "Cascade", "C-a-s-c-a-d-e")
     
            chaine_esp = Replace(chaine_esp, "°", "-")
            chaine_esp = Replace(chaine_esp, " ", "-")
            chaine_esp = Replace(chaine_esp, "é", "e")
            chaine_esp = Replace(chaine_esp, "è", "e")
            chaine_esp = Replace(chaine_esp, "ê", "e")
            chaine_esp = Replace(chaine_esp, "à", "a")
            chaine_esp = Replace(chaine_esp, "ô", "o")
            chaine_esp = Replace(chaine_esp, "ç", "c")
            chaine_esp = Replace(chaine_esp, "/", "-")
            chaine_esp = Replace(chaine_esp, ",", "-")
            chaine_esp = Replace(chaine_esp, ".", "-")
            chaine_esp = Replace(chaine_esp, "'", "-")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "---", "-")
            chaine_esp = Replace(chaine_esp, "--", "-")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            ' ajout le 21_12_09
            chaine_esp = Replace(chaine_esp, "Ö", "O")
            chaine_esp = Replace(chaine_esp, "ö", "o")
            chaine_esp = Replace(chaine_esp, "Ü", "U")
            chaine_esp = Replace(chaine_esp, "ü", "u")
                ' ajout le 10_06_10
        chaine_esp = Replace(chaine_esp, "ï", "i")
        chaine_esp = Replace(chaine_esp, "ë", "e")
        chaine_esp = Replace(chaine_esp, "î", "i")
        chaine_esp = Replace(chaine_esp, "û", "u")
     
        chaine_esp = Replace(chaine_esp, "â", "a")
        chaine_esp = Replace(chaine_esp, "ä", "a")
     
        chaine_esp = Replace(chaine_esp, "?", "")
     
            chaine_esp = LCase(chaine_esp)
            r_table![link] = chaine_esp
     
        ' creation meta_desc
            chaine_esp = r_table![Description]
     
            chaine_esp = Replace(chaine_esp, " , ", ", ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            r_table![Description] = chaine_esp
            r_table![meta_desc] = r_table![Description]
        ' creation meta_mots
            r_table![meta_mots] = r_table![meta_mots] & " " & r_table![Description]
     
     
            chaine_esp = r_table![meta_mots]
            chaine_esp = Replace(chaine_esp, ".", " ")
            chaine_esp = Replace(chaine_esp, ",", " ")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, " / ", "/")
            chaine_esp = Replace(chaine_esp, " , ", " ")
            chaine_esp = Replace(chaine_esp, " ", ", ")
     
            chaine_esp = Replace(chaine_esp, " à, ", "")
            chaine_esp = Replace(chaine_esp, " et, ", "")
            chaine_esp = Replace(chaine_esp, " de, ", "")
            chaine_esp = Replace(chaine_esp, " du, ", "")
            chaine_esp = Replace(chaine_esp, " des, ", "")
            chaine_esp = Replace(chaine_esp, " au, ", "")
            chaine_esp = Replace(chaine_esp, " je, ", "")
            chaine_esp = Replace(chaine_esp, " en, ", "")
            chaine_esp = Replace(chaine_esp, " d', ", "")
            chaine_esp = Replace(chaine_esp, " n°, ", "")
            chaine_esp = Replace(chaine_esp, " tout, ", "")
            chaine_esp = Replace(chaine_esp, " avec, ", "")
            chaine_esp = Replace(chaine_esp, " sans, ", "")
     
            chaine_esp = Replace(chaine_esp, " ex, ", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, "(", "")
            chaine_esp = Replace(chaine_esp, ")", "")
            chaine_esp = Replace(chaine_esp, " réf, ", "")
            chaine_esp = Replace(chaine_esp, ",", ", ")
            chaine_esp = Replace(chaine_esp, " S,  §,  T, ", " S§T, ")
            chaine_esp = Replace(chaine_esp, " j'en, ", "")
            chaine_esp = Replace(chaine_esp, " suis, ", "")
            chaine_esp = Replace(chaine_esp, """", "")
            chaine_esp = Replace(chaine_esp, "  ", " ")
            chaine_esp = Replace(chaine_esp, "§", "s")
     
     
            r_table![meta_mots] = chaine_esp
     
        ' creation meta_titre
     
            r_table![meta_tittle] = r_table![meta_desc]
     
        r_table.Update
        r_table.MoveNext
        If r_table.EOF = False Then
            If r_table![famille] <> pos_tmp Then
                pos_cpt = 1
                pos_tmp = r_table![famille]
            Else
                pos_cpt = pos_cpt + 1
            End If
            cpt = cpt + 1
        End If
    Loop
     
    Set r_table = Nothing
    Set bds = Nothing
     
    'requetes mise à jour des tables pour export
     
     
    'fab
    sql = "DELETE t_distant_fabricants.* FROM t_distant_fabricants;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_fab_maj_EXP"
    'cat
    sql = "DELETE t_distant_categories.* FROM t_distant_categories;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_categories_textes.* FROM t_distant_categories_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_cat_maj_EXP"
    DoCmd.OpenQuery "r_cat_lang_maj_EXP"
    'prod
    sql = "DELETE t_distant_produits.* FROM t_distant_produits;"
    DoCmd.RunSQL sql
    sql = "DELETE t_distant_produits_textes.* FROM t_distant_produits_textes;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_maj_EXP"
    DoCmd.OpenQuery "r_ref_maj_lang_EXP"
    'lien prod cat
    sql = "DELETE t_distant_categories_produits.* FROM t_distant_categories_produits;"
    DoCmd.RunSQL sql
    DoCmd.OpenQuery "r_ref_cat_maj_EXP"
    'lien prod cat pour tous les produits
    DoCmd.OpenQuery "r_ref_cat_maj_TLA_EXP"
     
    Me![info] = "Fin de la procédure"
    Me.Repaint
     
    Exit_preparation_locale_Click:
        Exit Sub
     
    Err_preparation_locale_Click:
        MsgBox Err.Description
        Resume Exit_preparation_locale_Click
     
    End Sub
    Private Sub sauve_donnees_images_Click()
    On Error GoTo Err_sauve_donnees_images_Click
    Dim sql As String
    sql = "DELETE t_images.* FROM t_images;"
    DoCmd.RunSQL sql
     
    sql = "DELETE t_images_lang.* FROM t_images_lang;"
    DoCmd.RunSQL sql
     
    sql = "INSERT INTO t_images ( id_image, id_product, [position], cover ) " & _
    "SELECT dom_ps_image.id_image, dom_ps_image.id_product, dom_ps_image.position, dom_ps_image.cover " & _
    "FROM dom_ps_image;"
    DoCmd.RunSQL sql
     
     
    sql = "INSERT INTO t_images_lang ( id_image, id_lang, legend ) " & _
    "SELECT dom_ps_image_lang.id_image, dom_ps_image_lang.id_lang, dom_ps_image_lang.legend " & _
    "FROM dom_ps_image_lang;"
    DoCmd.RunSQL sql
     
    Exit_sauve_donnees_images_Click:
        Exit Sub
     
    Err_sauve_donnees_images_Click:
        MsgBox Err.Description
        Resume Exit_sauve_donnees_images_Click
     
    End Sub
    Private Sub Commande31_Click()
    On Error GoTo Err_Commande31_Click
     
     
        DoCmd.OpenQuery "r_cpt_img"
     
    Exit_Commande31_Click:
        Exit Sub
     
    Err_Commande31_Click:
        MsgBox Err.Description
        Resume Exit_Commande31_Click
     
    End Sub

  18. #18
    Expert confirmé

    Homme Profil pro
    consultant développeur
    Inscrit en
    Mai 2005
    Messages
    2 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : consultant développeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 878
    Points : 4 754
    Points
    4 754
    Par défaut
    Alors c'est mieux car tu n'as plus d'erreur détectée ...

    mais que veux tu faire ds form_timer car actuellement le code suivant n'a aucune utilité
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    table_1 = "dom_ps_zone"
    Set r_table_1 = bds_1.OpenDAO.Recordset(table_1, dbOpenDynaset)
    r_table_1.MoveFirst
    Set r_table_1 = Nothing
    Set bds_1 = Nothing
    car tu ouvres un recordet, puis tu le fermes aussitôt ...

    Cdlt
    "Always look at the bright side of life." Monty Python.

  19. #19
    Nouveau Candidat au Club
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Septembre 2016
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Technicien maintenance

    Informations forums :
    Inscription : Septembre 2016
    Messages : 11
    Points : 1
    Points
    1
    Par défaut
    Bonsoir, Micniv
    ça ne fonctionne pas
    je t'ai envoyé un message sur ta messagerie la tu reçu ?
    Merci

  20. #20
    Expert confirmé

    Homme Profil pro
    consultant développeur
    Inscrit en
    Mai 2005
    Messages
    2 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : consultant développeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 878
    Points : 4 754
    Points
    4 754
    Par défaut
    Pegaso,
    je viens de te répondre;
    Cordialement
    "Always look at the bright side of life." Monty Python.

Discussions similaires

  1. erreur 94 utilisation incorrecte de null
    Par caossak dans le forum Général VBA
    Réponses: 2
    Dernier message: 24/06/2007, 11h00
  2. Réponses: 3
    Dernier message: 30/03/2007, 14h48
  3. Réponses: 6
    Dernier message: 03/07/2006, 08h26
  4. Utilisation incorrecte de Null ?
    Par pafi76 dans le forum Access
    Réponses: 6
    Dernier message: 28/06/2006, 09h40
  5. Utilisation incorrecte de Null ?
    Par illight dans le forum Access
    Réponses: 2
    Dernier message: 23/11/2005, 10h27

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