Using a centralized VBA module in multiple Access databases

前端 未结 3 1565
离开以前
离开以前 2020-12-02 19:51

I\'ve been put in charge of 50+ Access databases (.mdb\'s and .accdb\'s of varied versions) spread around an intranet, and I need to add a few VBA functions (the exact same

相关标签:
3条回答
  • 2020-12-02 20:12

    Don't worry, it's quite simple.

    1. Make your "helper" database. Put a few procedures in there.
    2. In your 'client' databases, open the VBA Editor
    3. Go to Tools->References. Browse and select your helper database.
    4. Done! You can now use all the functions in your helper database throughout your client databases.

    So... no .dll files to worry about. No Visual Studio needed.

    0 讨论(0)
  • 2020-12-02 20:18

    The search term is add-ins. (Ahh, I see Google has improved the search experience with words with embedded hyphnes since the last time I tried.) the approach mentioned by PowerUser will work but there are a number of issues.

    • You will want to distrubte the add-in along with your FE to the users PCs.

    • An MDE/ACCDE cannot reference an MDB/ACCDB. But if you change the add-in MDE/ACCDE you must redistribute the FE MDE/ACCDE as well. Even though you didn't make any changes to the parameters or subroutine/function names.

    • While you are debugging the code in the add-in or dealing with an error message VBA will open the add-in VBA code editor. Do NOT make changes there. They will be lost as soon as you close the add-in code window.

    See my Add-in Tips, Hints and Gotchas page for more details.

    0 讨论(0)
  • 2020-12-02 20:22

    You could also take it a step further. I wrote an article on this for vb123.com:

    Using Database Library Files in your Access Application

    You can use forms, reports, queries, modules, classes... Pretty much everything except subforms. And all in a plain old mdb or accdb file (or mde, for that matter).

    0 讨论(0)
提交回复
热议问题