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

Runtime Discussion :

Attacher les tables avec un Runtime [AC-2007]


Sujet :

Runtime

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut Attacher les tables avec un Runtime
    Bonjour TOUS,

    Base crée sous ACCESS 2007, partagée en deux (Front End et Back-End)
    Pourquoi ?
    Tout simplement pour que cette application puisse être installée n'importe où, sur un disque et répertoire non définis à l'avance, les deux parties pouvant être dans un même répertoire ou non.
    Et aussi qu'une fois installées, si on ajoute un réseau, pouvoir mettre les tables (Back-End) sur le serveur.
    Il est donc nécessaire de pouvoir réattacher les tables à volonté.
    Cette opération basique est très facilement réalisée avec les outils fournis en
    standard de ACCESS 2007 (Table Link Manager) -
    "nb: excusez mon franglais mais j'ai une version US du Pack Office Pro 2007"

    Ceci permet d'avoir:
    A - plusieurs Front-End (personnalisés) donc différents les uns des autres autorisant ou non, à travers les menus et options l'accès à certaines données.
    B - une mise à jour ou modification des Front-Ends sans avoir besoin d'accéder aux tables ou interdire leur utilisation pendant le développement.
    - Suis-je clair ?

    Donc, at home, tout cela fonctionne très bien, le "hic" est que cette application doit fonctionner avec un RUNTIME 2007.

    J'ai donc fait une copie de ma base en: ".accde" (compilée) et ouvert celle-ci en mode runtime par la commande:

    "C:\Users\Documents\ACCUEIL\BaseStats\MaBaseStats_Appli.accde" /runtime"
    (ACCESS 2007 étant installé sur mon PC, le "runtime" ne s'exécute pas, il faut simuler ce mode de fonctionnement.)

    Dans ce mode "pseudo-runtime", l'accès au Gestionnaire des tables" n'est pas accessible.
    J'ai donc utilisé une procédure "piochée" dans un bouquin (ACCESS 2000) et adaptée qui fonctionne parfaitement dans cette simulation.
    J'ai renommé les tables et/ou changé de répertoire, les 'ré-attaches' sont OK.

    Pourtant, quand j'ai voulu mettre cette base dans le PC avec seulement le "RUNTIME" cette procédure ne fonctionne pas, elle essaie bien de relier les tables avec le nouveau chemin, MAIS garde la trace des attaches précédemment définies (table MySysObjects), donc conflit - et PATATRAS ! Je suis coincé !

    J'ai bien essayé de "créer", sur mon PC, un chemin identique (mais très long) à celui du destinataire de l'application, mais VISTA ne me laisse pas créer de répertoire dans la racine du disque, il me redirige vers "documents,..."


    Dans la FAQ ACCESS j'ai consulté plusieurs infos, notamment:

    Comment récupérer le chemin d'accès à la Base contenant les tables ?

    Comment récupérer le chemin d'accès à la Base contenant les tables par ADO ?

    Ces procédures (anciennes) ne fonctionnent pas avec ACCESS 2007
    (ou alors je me suis fourvoyé en les essayant),elles sont prévues avec:

    - Microsoft DAO 3.6 Object Library
    qui n'existe pas dans ACCESS 2007, si on essaie de l'ajouter dans
    Visual Basic/Outils/References, celle-ci existe bien mais elle crée un conflit
    avec un autre objet de la librairie:
    Microsoft Access 12.0 Object Library

    - ou alors avec une structure type serveur SQL, ce qui n'est pas mon cas.

    Auriez vous un tuyau pour corriger cela et pouvoir réattacher mes tables
    sous "RUNTIME 2007", quel que soit les chemin ?

    Merci

    Cordialement

    frédéric

  2. #2
    Membre émérite Avatar de curt
    Homme Profil pro
    Ingénieur Etudes
    Inscrit en
    Mars 2006
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Etudes
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 576
    Points : 2 554
    Points
    2 554
    Par défaut
    Bonsoir fred75,

    que de questions et de problèmes... déjà résolus !!

    La réponse a déjà été traité là : http://www.developpez.net/forums/d22...me-access2003/ et le complément ici : http://www.developpez.net/forums/d73...-ok-mdb-accdb/

    Pour ce qui est de l'interdiction d'écrire dans C:\Programs files avec Vista, il suffit de désactiver le UAC (User Account Controler ) - Ensuite, tu peux mettre ton applis dans ce répertoire (déclare-le comme dossier sûr dans la gestion de confidentialité).

    Bonne soirée.
    Curt

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt,

    Merci pour la diligente réponse !

    Tout cela semble bien, et je dirai même, très lourd !
    Je vais faire le "tour" et essayer d'en tirer quelque chose pour répondre à mon besoin sans passer par "l'empaquetage", etc.

    Microsoft aurait pu laisser une "petite" porte ouverte dans le runtime, ne serait-ce que pour gérer ce genre de choses, non ?

    Merci - je donnerai signe de ma progression.

    frédéric

  4. #4
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt,

    Commence mal, j'ai enlevé l'UAC de Vista,

    J'ai voulu créer le répertoire

    C:\Documents and settings

    correspondant au premier nivau répertoire sur le PC de destination, (sous XP)

    eh bé, Vista me jette avec un message:
    "ce nouveau répertoire est déplacé automatiquement vers C:\Users"
    En fait j'avais déjà essayé cela et j'avais eu le même message!
    Faudra que j'analyse les propositions relevées sur le forum et indiquées par toi !
    Pfffff, prends la tête !

    Merci

  5. #5
    Membre éclairé

    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Juillet 2005
    Messages : 626
    Points : 726
    Points
    726
    Par défaut Connexion aux bases
    Bonjour,

    Je m'incruste dans ce post pour informer "fred75" de mon expérience avec le runtime access 2007.
    il vaut mieux avec Vista créer un dossier spécifique à ton appli ex "c:\monappli" mais ça je pense que tu l'avais compris.

    Pour le reste il faut tester la validité de la nouvelle base à connecter si c'est bon, délier puis lier la nouvelle.
    Pour faire ce taffe j'utilise adox aucun souci pour connecter une base n'importe d'où sur le PC ou le réseau.
    Microsoft ADO Ext x.x for DDL and Security

    Attention pour le répertoires spéciaux j'interroge les API c'est plus sûr pour le portage.

    Bon courage

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonjour Curt & Naphta,

    Merci de vos commentaires et suggestions, j'ai commencé à essayer la procédure mentionnée par Curt avec le lien

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     http://www.developpez.net/forums/d22...me-access2003
    sur le commentaire de Stargate SG1

    Je plante (voir commentaire 'ICI, sur les lignes ci-dessous:

    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
       Dim catDB   As ADOX.Catalog
        Dim tblLink As ADOX.Table                  'ICI
        Dim strDBLinkFrom As String                'ICI
        Dim strDBLinkSource As String
     
        Dim lngValueBarre As String                'ICI
     
      Me.BarreProgression.Visible = True
        lngValueBarre = 1
        Me.BarreProgression.Value = lngValueBarre  'ICI
     
     
        strDBLinkFrom = Me.txtCheminBase
        strDBLinkSource = Me.txtCheminData
    On Error GoTo gestErreurFichier
        Set catDB = New ADOX.Catalog           'ICI
        ' Ouvre un objet Catalog pour la base de données dans laquelle les liens doivent être actualisés.
    Je me moque de la barre de progression, (non indispensable),
    J'ai fait le formulaire et sur le bouton "cmdParcourir1" (pour reprendre le listing et éviter les confusions), j'ouvre bien une boîte de dialogue qui me permet de définir le chemin d'accès à l'application mais le bouton "commande4" qui devrait me permettre de définir le chemin des tables liées, se plante sur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Set catDB = New ADOX.Catalog
    Je trouve où cet ADOX ?

    Merci pour vos conseils et soutien (j'en ai bien besoin !)

  7. #7
    Membre éclairé

    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Juillet 2005
    Messages : 626
    Points : 726
    Points
    726
    Par défaut Liaison de tables
    Bonjour,

    Pour savoir après avoir ajouter du code si tu possèdes toutes les références nécessaires, tu lances une compilation dans le code.
    Apparemment chez toi cela s'arrête dès le début.

    Il faut ajouter le référence msadox.dll dans la fenêtre du code à outils>références>Parcourir
    ce fichier :
    C:\Program Files\Fichiers communs\System\ado\msadox.dll

    Pour ma part ça était un peu sportif car j'avais des tables locales et liées.
    Il fallait donc supprimer les tables liées uniquement puis les reconnecter.

    Bonne chance

  8. #8
    Membre émérite Avatar de curt
    Homme Profil pro
    Ingénieur Etudes
    Inscrit en
    Mars 2006
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Etudes
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 576
    Points : 2 554
    Points
    2 554
    Par défaut
    Bonsoir Fred75 et Naphta,

    c'est mon jour de bonté et j'ai tellement galéré pour mettre la liaison des tables en place que c'est un plaisir d'en faire partager les autres.

    Plutôt que de grandes explications, j'ai mis une base en pièce jointe. Il n'y a plus qu'à tester avant d'importer les tables, formulaires et modules dans vos applis.

    Au premier lancement, un formulaire s'ouvre demandant "Où sont les fichiers ?" Frontal et Dorsal. On renseigne et on valide.

    L'appli se ferme. Il suffit de la relancer et on accède aux données.
    ça répond complètement aux soucis qu'on rencontre quand on a à déployer une base sur des sites aux unités lecteurs réseaux différents.

    Important :
    • Sur Vista, il faut mettre en référence [Microsoft ADO Ext. 6.8 for DDL and Security]


    • Sur Xp pro, il faut mettre en référence [Microsoft ADO Ext. 2.8 for DDL and Security]


    * La version en pièce jointe est sur XP pro et fonctionnera sans problème sur Vista.

    Merci à Stargate SG1 pour son code et ses conseils.

    Bonne soirée.

    Curt

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt,

    Merci, je "bichais" comme un malade et j'ai ouvert (un peu confus quant aux noms des fichiers), mais ouverts et lancés, BINGO, Euréka!!

    Donc j'étais tout content !
    Puis j'ai voulu faire un test comme avec la version compilée, là j'ai vu que ton fichier était en version 2000.
    Je l'ai converti en ACCESS 2007, puis GROSSE déception, ça ne marche plus !

    Manifestement, l'extension des fichiers en .accdb (pour Access 2007) ne lui plaît pas du tout, il n'accepte pas et la table n'est pas modifiée.
    J'ai essayé de différentes manières mais sans succès.

    Je suis revenu aux fichiers en .mdb, c'est OK !

    Dans le module, il est fait mention du moteur Jet, j'ai cru comprendre que 2007 n'utilise plus de moteur Jet ?

    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
     catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & strDBLinkFrom '<<<<<<<<<<<<<<<
     
       'MsgBox catDB.ActiveConnection
     
        For Each tblLink In catDB.Tables
     
            ' Vérifie qu'il s'agit bien d'une table liée.
     
            If tblLink.Type = "LINK" Then
                tblLink.Properties("Jet OLEDB:Link Datasource") = strDBLinkSource
            End If
     
        Next
     
        Set catDB = Nothing
     
        MsgBox "L'accès aux données a été rétablies avec succés." _
        & vbNewLine & "L'application va être fermée.", vbOKOnly + vbInformation, "L'application vous informe !"
        setCheminCourant = (Me.BaseDocuments.Value)
    Je ne sais comment de remercier de tes louables efforts, personnellement, je galère au travers une pile de bouquins la plupart sont Access 97, 2000),
    j'ai essayé moults configurations - je crois maintenant comprendre !
    Je suis également en train d'essayer avec un démo du bouquin ACCESS 2007, Inside Out (version US).
    Y'a une demo qui marche mais pas quand j'importe les modules, j'ai des "insultes"j'ai du rater quelque chose !

    Et si le grand manitou (Laurent) pouvait nous tuyauter ?

    Merci encore et bon week-end

    fred

  10. #10
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt & Naphta,

    Vérifié, j'ai bien le "msadox.dll"
    et ADO Ext 6.0 for DLL and Security

    Quand je pourrai "respirer", je peux vous montrer la procédure qui marche
    (sur mon PC) mais qui plante sous le RUNTIME.
    Ca ressemble d'ailleurs beaucoup à la tienne Curt.

    Bon week-end

  11. #11
    Membre émérite Avatar de curt
    Homme Profil pro
    Ingénieur Etudes
    Inscrit en
    Mars 2006
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Etudes
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 576
    Points : 2 554
    Points
    2 554
    Par défaut
    Bonsdir Fred75,

    t'as raison et ... t'as tord.

    T'as raison : l'extension accdb ne passe pas
    T'as tord : la réponse est la : http://www.developpez.net/forums/d73...-ok-mdb-accdb/

    Je l'avais précisé dans mon premier message

    Tu dois télécharger le complèment chez Bill !!! http://www.microsoft.com/downloads/d...2-ef94e038c891

    Après ça roule tout seul.

    Un dernier point : laisse tomber les "vieux bouquins" d'access. Tu en trouveras en version 2007 à partir de 15 Euros dans les boutiques habituelles. C'est tout plein de bons tuyaux... Y'a le site http://developpez.com qu'est pas mal non plus !!!

    Curt

  12. #12
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt,

    Merci de la "permanence", il se fait tard, verrai demain les nouveaux tuyaux !

    Bonne nuit

    fred

  13. #13
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonjour Curt,

    Bon je suis allé voir les liens ci-dessus, téléchargé et installé le "AccessDatabaseEngine.exe"
    Ca n'a pas eu l'air de changer grand-chose !

    Je suis allé sur le lien:

    http://msdn.microsoft.com/en-us/data/aa937729.aspx

    j'ai suivi le modèle proposé (mais cette procédure en fait propose certains
    commentaires d'un package d'installation et n'est pas complète !), sans aboutir !

    Ca commence à me "raser" sérieusement cette galère !

    Pour info, j'ai utilisé la procédure de:

    http://www.jstreettech.com/cartgenie...rDownloads.asp

    le fichier à télécharger: J Street Access Relinker.exe


    leur offre (gratuite):

    Here is the Access table relinking utility that J Street has used in all of our
    Access applications for years. It is an essential tool after you have split your
    database into a front-end application and a back-end database.
    It handles multiple back-end Access databases, checks your linked tables on startup,
    prompts your user to locate the back-end database if needed, and even has an automatic mode
    that relinks to local databases without prompting.
    Access 2000/XP/2003/2007, 76 KB.

    Ca marche très bien, sur mon PC, en " .accde" et démarrage avec l'option " /runtime" sous Access 2007,
    sauf que lorsque j'ai voulu l'installer chez l'utilisateur final, sous XP et avec le "runtime" ça ne fonctionnait pas
    correctement (liens renouvelés mais avec les anciens toujours présents).
    Enfin c'est ce que j'ai expliqué au début et initié la raison de ma demande d'aide.

    Donc je suis en train de me noyer dans toutes ces informations (et modifs).
    Je fais une pause sinon j'explose - franchement y'aurait rien de simple
    et "éprouvé et complet (comme ton fichier, par exemple) mais opérationnel, sous ACCESS 2007, disponible quelque part ?

    J'ai vu ce qui pourrait correspondre tout à fait:

    Un outil qui répond parfaitement à tous ces problèmes, mais un peu cher (tout est relatif !)

    http://www.fmsinc.com/MicrosoftAcces...auncher_om.asp

    mais 500 $ pour un poste !

    Merci de l'aide.

    Cordialement
    Fichiers attachés Fichiers attachés

  14. #14
    Membre émérite Avatar de curt
    Homme Profil pro
    Ingénieur Etudes
    Inscrit en
    Mars 2006
    Messages
    1 576
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Etudes
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 576
    Points : 2 554
    Points
    2 554
    Par défaut
    Bonsoir Fred75,

    dommage d'aller voir ailleurs (payant) ce qu'on offre ici (gratuit).

    Si quelqu'un d'autre veut bien tester la base mise en pièce jointe 3 mails plus haut, ça me conforterait dans ma bonne action de mettre à disposition de tous un petit utilitaire qui fonctionne parfaitement chez moi.

    Merci à vous.
    Curt

  15. #15
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mars 2008
    Messages : 25
    Points : 19
    Points
    19
    Par défaut
    Bonsoir Curt,

    Non, non, le fichier joint est "GRATUIT" et fonctionne sous ACCESS 2007.

    De plus, j'ai récupéré (et adapté car l'extension .accdb n'existait pas à
    l'époque), une 'vieille' procédure, la limitation est qu'il rétablit un "lien défini en dur",
    et uniquement dans le répertoire courant de l'appli.
    Dans certains cas, cela peut être utile (notamment pour ma version .accde et
    runtime chez l'utilisateur final.
    Je l'ai laissée dans son "jus", très bien documenté et en anglais (c'est mieux !).

    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
    Option Compare Database
     
    'This library is old (2.0 I think) anyway it still compiles under A97,
    'basically, you call OpenDialog to get the full path to your tables
    'database and pass it with a comma delinited string of the tables
    'within that db you want linked to LinkTables(FullPath As String,
    'Tables As String)
     
    'have fun
     
    'Nothing fancy here, just copy this into a module and compile. This
    'libray makes reference to my error handler library which I'm not posting
    'so correct anyway you want.
     
    'Option Compare Database
    Option Explicit
     
    Type ParsePathCB ' ParsePath control block
        sDrive As String ' Drive letter with terminator (:)
        sDirName As String ' Directory path name with terminator(s) (\)
        sFilName As String ' File name without terminator(s) (.)
        sExt As String ' File name without terminator(s) (.)
    End Type
     
    Type ListCB ' GetList(), CutList()Control block
        ActiveFlag As Boolean ' Working on active list
        ListLen As Long ' List length
        DelimitLen As Long ' Delimitor length
        ListPos As Long ' Current list position
        DelimitPos As Long ' Current delimitor position
    End Type
     
    ' The OPENFILENAME structure contains information the operating system uses to initialize
    ' the system-defined Open or Save As dialog box. After the user closes the dialog box,
    ' the system returns information about the user’s selection in this structure.
     
    Private Type OPENFILENAME
    lStructSize As Long ' Specifies the length, in bytes, of the structure
    hwndOwner As Long ' Identifies the window that owns the dialog box.
                      ' This member can be any valid window handle, or NULL if the dialog box has no owner
    hInstance As Long ' Identifies a data block that contains a dialog box template specified by the lpstrTemplateName
                        'member. This member is used only if the Flags member specifies the
                        'OFN_ENABLETEMPLATE flag; otherwise, this member is ignored
    lpstrFilter As String ' Points to a buffer containing pairs of null-terminated filter strings.
                          'The first string in each pair describes a filter (for example, Text Files), the second
                          'specifies the filter pattern (for example, *.TXT). Multiple filters
                          'can be specified for a single item by separating the filter-pattern
                          'strings with a semicolon (for example, *.TXT;*.DOC;*.BAK). The last
                          'string in the buffer must be terminated by two NULL characters. If
                          'this parameter is NULL, the dialog box will not display any filters.
                          'The filter strings are assumed to be in the proper order the operating
                          'system does not change the order
    lpstrCustomFilter As String ' Points to a buffer containing a pair of user-defined filter strings.
                                'The first string describes the filter, and the second specifies the filter pattern (for
                                'example WinWord, *.docnn). The buffer is terminated by two NULL
                                'characters. The operating system copies the strings to the buffer when
                                'the user closes the dialog box. The system uses the strings to
                                'initialize the user-defined file filter the next time the dialog box
                                'is created. If this parameter is NULL, the dialog box lists but does
                                'not save user-defined filter strings
    nMaxCustFilter As Long ' Specifies the size, in characters, of the buffer identified by the lpstrCustomFilter member.
                           'This buffer should be at least 40 characters long. This parameter is
                           'ignored if the lpstrCustomFilter member is NULL or points to a NULL string
    nFilterIndex As Long ' Specifies an index into the buffer pointed to by the lpstrFilter member.
                         'The operating system uses the index value to obtain a pair of strings to use as the initial
                         'filter description and filter pattern for the dialog box.
                         'The first pair of strings has an index value of 1. When the user closes the
                         'dialog box, the system copies the index of the selected filter strings
                         'into this location. If the nFilterIndex member is 0, the custom filter
                         'is used. If the nFilterIndex member is 0 and the lpstrCustomFilter
                         'member is NULL, the system uses the first filter in the buffer
                         'identified by the lpstrFilter member. If all three members are 0 or
                         'NULL, the system does not use any filters and does not show any files
                         'in the file list control of the dialog box
    lpstrFile As String ' Points to a buffer that contains a filename used to initialize the File Name edit control. The
                        'first character of this buffer must be NULL if initialization is not
                        'necessary. When the GetOpenFileName or GetSaveFileName function
                        'returns, this buffer contains the drive designator, path, filename,
                        'and extension of the selected file. If the buffer is too small, the
                        'dialog box procedure copies the required size into this member
    nMaxFile As Long ' Specifies the size, in characters, of the buffer pointed to by the lpstrFile member. The
                        'GetOpenFileName and GetSaveFileName functions return FALSE if the
                        'buffer is too small to contain the file information. The buffer should
                        'be at least 256 characters long. This member is ignored if the lpstrFile Member Is Null
    lpstrFileTitle As String ' Points to a buffer that receives the title of the selected file. For Windows versions 3.0 and
                            '3.1, this buffer receives the filename and extension without path
                            'information. This application should use this string to display the
                            'file title. If this member is NULL, the function does not copy the file Title
    nMaxFileTitle As Long ' Specifies the maximum length of the string that can be copied into the lpstrFileTitle
                            'buffer. This member is ignored if lpstrFileTitle is NULL
    lpstrInitialDir As String ' Points to a string that specifies the initial file directory. If this member is NULL, the
                                'system uses the current directory as the initial directory
    lpstrTitle As String ' Points to a string to be placed in the title bar of the dialog box. If this member is NULL, the
                         'system uses the default title (that is, Save As or Open)
    Flags As Long ' Specifies the dialog box creation flags. This member may be a combination of the OFN_ values
    nFileOffset As Integer ' Specifies a zero-based offset from the beginning of the path to the filename in the string to
                            'which the lpstrFile member points. For example, if lpstrFile points to
                            'the following string, c:\dir1\dir2\file.ext, this member contains the Value 13
    nFileExtension As Integer ' Specifies a zero-based offset from the beginning of the path to the filename extension in the
                                'string pointed to by the lpstrFile member. For example, if lpstrFile
                                'points to the following string, c:\dir1\dir2\file.ext, this member
                                'contains the value 18. If the user did not type an extension and
                                'lpstrDefExt is NULL, this member specifies an offset to the
                                'terminating null character. If the user typed. as the last character
                                'in the filename, this member specifies 0
    lpstrDefExt As String ' Points to a buffer that contains the default extension. The GetOpenFileName and
                            'GetSaveFileName functions append this extension to the filename if the
                            'user fails to type an extension. This string can be any length, but
                            'only the first three characters are appended. The string should not
                            'contain a period (.). If this member is NULL and the user fails to
                            'type an extension, no extension is appended
    lCustData As Long ' Specifies application-defined data that the operating system passes to the hook
                        'function identified by the lpfnHook member. The system passes the data
                        'in the lParam parameter of the WM_INITDIALOG message
    lpfnHook As Long ' Points to a hook function that processes messages intended for the dialog box. An
                    'application must specify the OFN_ENABLEHOOK flag in the Flags member
                    'to enable the function; otherwise, the operating system ignores this
                    'structure member. The hook function should return FALSE to pass a
                    'message to the standard dialog box procedure, or TRUE to discard the message
    lpTemplateName As String ' Points to a null-terminated string that names the dialog box template resource to
                    'be substituted for the standard dialog box template. An application
                    'can use the MAKEINTRESOURCE macro for numbered dialog box resources.
                    'This member is used only if the Flags member specifies the
                    'OFN_ENABLETEMPLATE flag; otherwise, this member is ignored
    End Type
     
    Public Const OFN_READONLY = &H1 ' Causes the Read Only check box to be checked initially when the dialog box is created.
                                    'Indicates the state of the Read Only check box when the dialog box is closed
    Public Const OFN_OVERWRITEPROMPT = &H2 ' Causes the Save As dialog box to generate a message box if the selected file already
                                    'exists. The user must confirm whether to overwrite the file
    Public Const OFN_HIDEREADONLY = &H4 ' Hides the Read Only check box
    Public Const OFN_NOCHANGEDIR = &H8 ' Causes the dialog box to set the current directory back to what it was when the dialog box was called
    Public Const OFN_SHOWHELP = &H10 ' Causes the dialog box to show the Help button. The hwndOwner member must not be NULL if this option is specified
    Public Const OFN_ENABLEHOOK = &H20 ' Enables the hook function specified in the lpfnHook member
    Public Const OFN_ENABLETEMPLATE = &H40 ' Causes the operating system to create the dialog box by using the dialog box template
                                            'identified by the hInstance and lpTemplateName members
    Public Const OFN_ENABLETEMPLATEHANDLE = &H80 ' Indicates that the hInstance member identifies a data block that contains a preloaded
                                    'dialog box template. The operating system ignores the lpTemplateName
                                    'member if this flag is specified
    Public Const OFN_NOVALIDATE = &H100 ' Specifies that the common dialog boxes allow invalid characters in the returned filename.
                        'Typically, the calling application uses a hook function that checks
                        'the filename by using the FILEOKSTRING registered message. If the text
                        'box in the edit control is empty or contains nothing but spaces, the
                        'lists of files and directories are updated. If the text box in the
                        'edit control contains anything else, the nFileOffset and
                        'nFileExtension members are set to values generated by parsing the
                        'text. No default extension is added to the text, nor is text copied to
                        'the lpstrFileTitle buffer.
                        ' If the value specified
                        'by the nFileOffset member is negative, the filename is invalid. If the
                        'value specified by nFileOffset is not negative, the filename is valid,
                        'and the nFileOffset and nFileExtension members can be used as if the
                        'OFN_NOVALIDATE flag had not been set
    Public Const OFN_ALLOWMULTISELECT = &H200 ' Specifies that the File Name list box allows multiple selections. (If the dialog box is
                        'created by using a private template, the LBS_EXTENDEDSEL constant must
                        'appear in the definition of the File Name list box.)
    Public Const OFN_EXTENSIONDIFFERENT = &H400 ' Specifies that the user
                'typed a filename extension that differs from the extension specified
                'by the lpstrDefExt member. The function does not set this flag if
                'lpstrDefExt is NULL
    Public Const OFN_PATHMUSTEXIST = &H800 ' Specifies that the user
                'can type only valid path and filenames. If this flag is set and the
                'user types an invalid path and filename in the File Name entry field,
                'the dialog box function displays a warning in a message box
    Public Const OFN_FILEMUSTEXIST = &H1000 ' Specifies that the user
                'can type only names of existing files in the File Name entry field. If
                'this flag is set and the user enters an invalid filename in the File
                'Name entry field, the dialog box function displays a warning in a
                'message box. The setting of this flag causes the OFN_PATHMUSTEXIST
                'flag to be set
    Public Const OFN_CREATEPROMPT = &H2000 ' Specifies that the
                'dialog box function should ask whether the user wants to create a file
                'that does not currently exist. (This flag automatically sets the
                'OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST flags.)
    Public Const OFN_SHAREAWARE = &H4000 ' Specifies that if a call
                'to the OpenFile function fails because of a network sharing violation,
                'the error is ignored and the dialog box returns the given filename. If
                'this flag is not set, the registered message for SHAREVISTRING is sent
                'to the hook function, with a pointer to a null-terminated string for
                'the path and filename in the lParam parameter. The hook function
                'responds with one of the share values
    Public Const OFN_NOREADONLYRETURN = &H8000 ' Specifies that the
                'returned file does not have the Read Only check box checked and is not
                'in a write-protected directory
    Public Const OFN_NOTESTFILECREATE = &H10000 ' Specifies that the file
                'is not created before the dialog box is closed. This flag should be
                'set if the application saves the file on a create-nonmodify network
                'share point. When an application sets this flag, the library does not
                'check for write protection, a full disk, an open drive door, or
                'network protection. Applications using this flag must perform file
                'operations carefully, because a file cannot be reopened once it is closed
    Public Const OFN_NONETWORKBUTTON = &H20000 ' Hides and disables the network button
    Public Const OFN_NOLONGNAMES = &H40000 ' force no long names for 4.x modules
    Public Const OFN_EXPLORER = &H80000 ' new look commdlg
    Public Const OFN_NODEREFERENCELINKS = &H100000 '
    Public Const OFN_LONGNAMES = &H200000 ' force long names for 3.x Modules
     
    Public Const OFN_SHAREFALLTHROUGH = 2 ' Specifies that the filename is returned by the dialog box
    Public Const OFN_SHARENOWARN = 1 ' Specifies no further Action
    Public Const OFN_SHAREWARN = 0 ' Specifies that the user receives the standard warning message for this error, the same result
                'as if there were no hook function
     
    Private Declare Function api_GetOpenFileName Lib "comdlg32.dll" Alias _
    "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
     
    Public Function OpenDialog(cf As Form, Filter As String, Title As _
    String, InitDir As String) As String
        ' IniDir = "C:\My Documents"
        ' Title = "Find and Select File"
        ' Filter = "Microsoft Access Databases (*.mdb)|*.mdb|Microsoft Access Databases (*.mde)|(*.mde)|"
        ' FullPath = OpenDialog(Me, Filter, Title, IntDir)
     
    Dim OFN As OPENFILENAME ' open file name structure
    Dim t As Long ' terminator
     
    On Error GoTo ErrorRoute
     
    OFN.lStructSize = Len(OFN) ' set structure length
    OFN.hwndOwner = cf.hwnd ' set handle of owner form
     
    Do ' setup loop for filter terminator
    t = InStr(t + 1, Filter, "|") ' find filter terminator, if found, replace with null
    If t <> 0 Then Mid$(Filter, t, 1) = Chr$(0)
    Loop Until t = 0 ' loop until all terminators are replaced
     
    OFN.lpstrFilter = Filter ' set file filter
    OFN.lpstrFile = Space$(254) ' initialize return file name buffer (no starting file name)
    OFN.nMaxFile = 255 ' set size of lpstrFile buffer
    OFN.lpstrFileTitle = Space$(254) ' initialize return selected file title buffer
    OFN.nMaxFileTitle = 255 ' set size of lpstrFileTitle buffer
    OFN.lpstrInitialDir = InitDir ' set initial directory
    OFN.lpstrTitle = Title ' set dialog title
     
    ' Set dialog flags
    OFN.Flags = OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST
     
    t = api_GetOpenFileName(OFN) ' fire off dialog
    If (t) Then ' if file selected, return file Name
    OpenDialog = Left$(OFN.lpstrFile, Len(Trim$(OFN.lpstrFile)) - 1)
    Else ' if file not selected
    OpenDialog = "" ' return no file name
    End If ' if file selected
     
    Exit Function
    ErrorRoute: ' error routing
     
    'à voir !
    'ErrorRouter.ErrorHandler cf.Name & ".OpenDialog"
    End Function
     
    Public Function ListCount(List As String, Delimitor As String) As Long
    ' Counts the number of "Delimitor"'s in "List" and returns the number.
    Dim ListLen As Long ' Length of list
    Dim DelimitLen As Long ' Length of terminator
    Dim ListPos As Long ' Current list position
    Dim DelimitPos As Long ' Current delimitor position
    Dim DelimitCount As Long ' Total number of delimitors in list
    ListLen = Len(List) ' Set list length
    DelimitLen = Len(Delimitor) ' Set delimitor length
    ListPos = 1 ' Set defualt current list position
    Do ' Count delimitors, Find Delimitor
    DelimitPos = InStr(ListPos, List, Delimitor)
    If DelimitPos = 0 Then Exit Do ' If NO delimitor found,
    Exit Do
    DelimitCount = DelimitCount + 1 ' Increament delimitor Count
    ListPos = DelimitPos + DelimitLen ' Set next current list postion
    Loop Until ListPos >= ListLen ' Next delimitor
    ListCount = DelimitCount ' Return delimitor count
    End Function
     
    Public Sub ListCut(List As String, Cut As String, Delimitor As String, _
    CutDelimit As Boolean)
    ' Cuts from the first character in "List" up to and depending on the "CutDelimit" flag,
    ' including the "Delimitor" then loads it into "Cut". The rest of the List is reloaded
    ' back into "List".
    Dim DelimPos As Long ' Delimitor position
    Dim DelimLen As Long ' Delimitor length
    DelimLen = Len(Delimitor) ' Set Length of delimitor
    DelimPos = InStr(1, List, Delimitor) ' Find delimitor
    If DelimPos <> 0 Then ' If Delimitor found
    If CutDelimit Then ' If cut delimitor too
    Cut = Left$(List, DelimPos + (DelimLen - 1))
    Else ' If DON'T cut delimitor too
    Cut = Left$(List, DelimPos - 1)
    End If ' If cut delimitor too
    List = Mid$(List, DelimPos + DelimLen) ' Return rest of list
    Else ' If Delimitor NOT found
    Cut = "" ' Clear cut
    End If ' If Delimitor found
    End Sub
     
    Public Function ListGet(LgCB As ListCB, List As String, Member As _
    String, Delimitor As String, GetDelimit As Boolean) As Boolean
    ' Gets from the "CB.ListPos" character in "List" up to and depending on "CutDelimit" flag,
    ' including the "Delimitor" then loads it into "CB.Cut". The "CB.ListPos" is then set to
    ' just past the "Delimitor" so ListGet can be recalled, getting each member in the "List"
    ' until the end of the "List" is found. If the end of the "List" end with a "Delimitor" the
    ' last call will return into "CB.Cut" a blank string, if the end of the "List" doesn't end
    ' with a "Delimitor" the last call will return the remainder of the "List". The "List" is
    ' not altered.
    If Not LgCB.ActiveFlag Then ' If NOT working on active List
        LgCB.ListLen = Len(List) ' Get Length of new list
        LgCB.ListPos = 1 ' Set current list position
        LgCB.ActiveFlag = True ' Set working on active List flag
    End If ' If NOT working on active List
     
    LgCB.DelimitLen = Len(Delimitor) ' Get Length of new Delimitor
    ' Find delimitor
    LgCB.DelimitPos = InStr(LgCB.ListPos, List, Delimitor)
     
    If LgCB.DelimitPos <> 0 Then 'If delimitor found, Get Member
        If GetDelimit Then
        Member = Mid$(List, LgCB.ListPos, (LgCB.DelimitPos + LgCB.DelimitLen) - LgCB.ListPos)
        Else
            Member = Mid$(List, LgCB.ListPos, LgCB.DelimitPos - LgCB.ListPos)
        End If
    ' Set current list position for next get
        LgCB.ListPos = LgCB.DelimitPos + LgCB.DelimitLen
        ListGet = True ' Signal caller that there is data to process
            Else ' If terminator Not found
        If LgCB.ListLen >= LgCB.ListPos Then ' If partial member left in list
            Member = Mid$(List, LgCB.ListPos) ' Return partial list
            Else ' If partial line NOT left in list
            Member = "" ' Clear return
        End If ' If partial member left in list
            ListGet = False ' Signal caller that there is NO data to process
            LgCB.ActiveFlag = False ' Flag NOT working on active List
    End If ' If terminator found
     
    End Function
     
    Public Function LinkTable(FullPath As String, TableName As String) As Boolean
    Dim db As Database
    Dim td As TableDef
    On Error GoTo ErrorRoute ' error routing
    If TableExists(TableName) Then DeleteTable TableName
    Set db = CurrentDb ' link tables to current db
    Set td = db.CreateTableDef(TableName) ' create new table
    td.Connect = ";DATABASE=" & FullPath ' set server .mdb full Path
    td.SourceTableName = TableName ' set table name
    db.TableDefs.Append td ' add new table
    LinkTable = True
    Set db = Nothing
    Set td = Nothing
    Exit Function
    ErrorRoute:
    Err.Clear
    LinkTable = False
    End Function
     
    Public Sub DeleteTable(TableName As String)
    Dim db As Database
    Dim td As TableDef
    Set db = CurrentDb ' link tables to current db
    For Each td In db.TableDefs '
    If TableName = td.Name Then db.TableDefs.Delete TableName: Exit Sub
    Next td
    Set db = Nothing
    End Sub
     
    Public Sub UnlinkTables(Tables As String)
    Dim Names As String ' table names
    Dim LgCB As ListCB ' list get structure
    Dim c As Integer ' table count
    Dim t As Integer ' tables
    c = ListCount(Tables, ",") + 1 ' get number of tables
    If Tables <> "" Then ' if tables to unlink
    For t = 1 To c ' setup link loop
    ListGet LgCB, Tables, Names, ",", False ' get name form list
    DeleteTable Names ' unlink table
    Next t ' unlink next table
    End If ' if tables to unlink
    End Sub
     
    Public Sub LinkTables(FullPath As String, Tables As String)
    Dim Names As String ' table names
    Dim LgCB As ListCB ' list get structure
    Dim c As Integer ' table count
    Dim t As Integer ' tables
    c = ListCount(Tables, ",") + 1 ' get number of tables
    If Tables <> "" Then ' if tables to unlink
    For t = 1 To c ' setup link loop
    ListGet LgCB, Tables, Names, ",", False ' get name form list
    If Not LinkTable(FullPath, Names) Then ' if link to table failed
    Tables = "Link to table " & Chr$(34) & Names & Chr$(34) & " in database " _
    & Chr$(34) & FullPath & Chr$(34) & _
    " failed, make sure you are connecting to the proper database for this application and if so, repair and compact both databases."
    Err.Raise 40000, , Tables
    Exit Sub ' bail out
    End If
    Next t ' link next table
    End If ' if tables to link
    End Sub
     
    Public Function TablesExists(Tables As String, NotExist As String) As Boolean
    Dim Names As String ' table names
    Dim LgCB As ListCB ' list get structure
    Dim c As Integer ' table count
    Dim t As Integer ' tables
    TablesExists = True
    c = ListCount(Tables, ",") + 1 ' get number of tables
    If Tables <> "" Then ' if tables to unlink
    For t = 1 To c ' setup link loop
    ListGet LgCB, Tables, Names, ",", False ' get name form list
    If Not TableExists(Names) Then ' if table doesn't exist
    TablesExists = False ' signal caller that a Table doesn't exist
    If Len(NotExist) = 0 Then ' first non-existing table
    NotExist = Names ' start list
    Else ' first not non-existing Table
    NotExist = NotExist & "," & Names ' add table to list
    End If ' first non-existing table
    End If ' if table doesn't exist
    Next t ' link next table
    End If ' if tables to link
    End Function
     
    Public Function TableExists(TableName As String) As Boolean
    ' Check to see if Table (TableName) exists and return answer
    Dim db As Database ' Any Database
    Dim td As TableDef ' Any Table Definition
    Set db = CurrentDb ' Get current database
    For Each td In db.TableDefs ' Find table
    If td.Name = TableName Then ' If table found
    TableExists = True ' Signal caller that table found
    Exit Function ' Back to caller
    End If ' If table found
    Next td ' Check next table
    Set db = Nothing
    End Function
     
    Public Function IsFormLoaded(FormName As String) As Boolean
    ' Check to see if Form is loaded and return answer
    IsFormLoaded = (SysCmd(acSysCmdGetObjectState, acForm, FormName) <> 0)
    End Function
     
     
    Public Function UpdateTableLinks()
    'Const DEFAULT_BE_DB As String = "YOUR_BE_DATABASE_HERE_DATA_ONLY.mdb"
    Const DEFAULT_BE_DB As String = "NOM du FICHIER BACK-END_Data.accdb"
    On Error Resume Next
     
      Dim varThis As Variant
      Dim strThisFolder As String
      Dim strBEFileSpec As String
      Dim sTableName As String
      Dim sNewConnectionLink As String
     
      strThisFolder = CurrentProject.Path
      strBEFileSpec = strThisFolder & "\" & DEFAULT_BE_DB
     
      If MsgBox(Prompt:="Etes vous sur vous voulez updater remote table links to Back End at " & strBEFileSpec & "?", _
          Buttons:=vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
        For Each varThis In CurrentDb.TableDefs
     
            Debug.Print "Checking to update table:: " & varThis.Name
            With varThis
                If Trim(Nz(.Connect)) Like ";DATABASE=*" Then
                    Debug.Print "---Old Link:: " & Trim(Nz(.Connect))
                    sNewConnectionLink = ";DATABASE=" & strBEFileSpec
                    .Connect = sNewConnectionLink
                    .RefreshLink
                    Debug.Print "---New Link:: " & sNewConnectionLink
                End If
            End With
        Next varThis
     
        If Err.Number = 0 Then
            MsgBox "Relink complete!"
        Else
            MsgBox "Error: " & Err.Number & " " & Err.Description
            Err.Clear
        End If
      End If
    End Function
    on peut le lancer avec un bouton ou autre, selon les besoins.

    Ta procédure est très sympa, mais sous 2007 y'a problème - ou alors j'ai pas tout compris ! A essayer encore (mais plus tard, j'en ai ma claque !).

    Merci encore et au plaisir.

    frédéric

  16. #16
    Membre éclairé

    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    626
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Juillet 2005
    Messages : 626
    Points : 726
    Points
    726
    Par défaut du code pour les attaches
    Bonjour,

    Bon en PJ une base 2007 dans laquelle on trouve un formulaire d'attache et du code pour parcourir et sauvegarder.
    Ce formulaire a été conçu pour gérer un frontal qui au lancement ne trouve plus sa base qui aurait été effacée ou même volée.

    Cela fonctionne sur 2003 avec bureau distant, vista, xp, au format runtime ou pas.

    Bonne chance

  17. #17
    Membre à l'essai
    Inscrit en
    Mars 2009
    Messages
    17
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 17
    Points : 11
    Points
    11
    Par défaut
    Bonjour, (message particulièrement pour curt)

    J'ai le même problème:

    J'ai finalisé ma base et créé une dorsale et une frontale. Cela marche bien. Par contre quand je déplace la dorsale, ma frontale ne s'ouvre plus. Je me retrouve sur la page d'accueil d'access.

    J'ai donc télécharger ta base exemple Curt et te remercie au passage.
    Avec cette base, aucun problème (je peux déplacer la dorsale l'autoexec fonctionne). Quand j'importe mes tables, formulaires, etats.. , je renseigne l'emplacement de ma dorsale et cela fonctionne (l'autoexec fonctionne). Par contre, encore une fois quand je déplace la dorsale même problème, la frontale ne s'ouvre plus (j'arrive sur la page d'accueil d'access), comme si l'autoexec ne fonctionnait plus.

    Une idée pour m'aider ???

    Merci d'avance.

    TomZH

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. lier les tables avec runtime access2003
    Par logipsuroit dans le forum Runtime
    Réponses: 23
    Dernier message: 15/11/2016, 11h32
  2. Attacher les tables d'une base SQL server 2000
    Par dimitrak dans le forum VBA Access
    Réponses: 1
    Dernier message: 30/03/2008, 16h08
  3. Réponses: 1
    Dernier message: 18/07/2007, 00h02
  4. Attacher les tables par programmation
    Par ahouba dans le forum VBA Access
    Réponses: 1
    Dernier message: 05/05/2006, 18h29
  5. Attacher les tables par le code
    Par hilo_31 dans le forum Access
    Réponses: 1
    Dernier message: 22/02/2006, 17h09

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