Never tried this with Access, but this works with VbScript.
I have several Access databases that I support, and many of them have common code in modules & class modules. If I update a common module with fixes or new code, I then have to propagate that to all my other databases. For example, I have a utility module called modUtil, which contains a bunch of common routines.
When I add new code to modUtil in one of my databases, I then have to export the module for comparison. I then open another database and either delete modUtil and import the one exported from the other database, or export modUtil from 2nd database and use BeyondCompare or another file comparison utility to find differences and resolve them. This is quite time consuming, and must be repeated for each database that contains modUtil.
I noticed VbScript has a way of importing code into a script, and wondered if Access VBA could do this.
Here's some pseudocode for the concept, which could be executed from my AutoExec macro:
This could save a bunch of ongoing maintenance and keep code in my projects always current.Code:Open the Repository database For Each myModule In MyProject.Modules If myModule exists in Repository database If any differences between module code Delete myModule Import myModule from Repository database Set a flag so I know something was updated End If End If Next If flag shows any changes were made Save my database End If
Hopefully, this would work with common forms also.
Is this a good idea, or too fraught with risks to try?
Thanks...