Code library database (2 Viewers)

bodders24

Member
Local time
Today, 20:02
Joined
Oct 3, 2016
Messages
32
I have been considering how to re-use my generic VBA code and Access objects across multiple applications. These are for such standard things as : closing all forms, error reporting, connecting to SQL Server, startup routines, etc.

I am thinking of creating a code and object library database, and I would appreciate any feedback on the idea. If people have created one do you do anything specifically to identify the objects, e.g. prefix of AA (Access architecture) at the module or procedure/function level ?

Also how do you ensure that the database stays up to date with any changes or additions ?

Grateful for your thoughts

Bodders
 
One approach is to add your generic database as a reference to your project. Have you tried that?
 
> how do you ensure that the database stays up to date with any changes or additions

That can be very tricky. Let's consider how others like MSFT do this. The Windows API is one of MSFT's code libraries, and it has been VERY constant with regards to the public interface. They have to. If they change the arguments of say CreateWindow API call, all apps in the world will fail to create a window. In cases where they just HAD to have a more powerful CreateWindow, they came up with a new API: CreateWindowEx for extra special features. Within reason, CreateWindow's internals can change. For example the window might be created with slightly rounded corners, or just a hint of transparency in the window title.

If you follow in these footsteps, you will never distribute a new version of your library that is not compatible with existing apps.
 
I have been considering how to re-use my generic VBA code and Access objects across multiple applications. These are for such standard things as : closing all forms, error reporting, connecting to SQL Server, startup routines, etc.

I am thinking of creating a code and object library database, and I would appreciate any feedback on the idea. If people have created one do you do anything specifically to identify the objects, e.g. prefix of AA (Access architecture) at the module or procedure/function level ?

Also how do you ensure that the database stays up to date with any changes or additions ?

Grateful for your thoughts

Bodders
I learned the hard way what Tom warns about. I have used an accdb as a library reference for many years. It includes my error handler. The last time I decided to modify it, I ended up chasing down dozens, if not hundreds, of instances in nearly a dozen databases I use. Never again.

Instead, if you want to use new parameters for a sub or function, do so using the keyword Optional so you don't break everything, everywhere.
 
At first, I also used a collection of code libraries (At that time, I created them with Access Developer Extensions as DLL).
Due to the effort involved in maintaining different versions, I switched to a collection of codemodules that I could import into and update in the respective application. This made it easier to maintain the various applications. Improving the “library” codemodules is also easier, as I improve them in the respective application in which I am currently working with the codemodule. The codemodule is then exported to the code repository and is available for update for other applications.
To ensure that I don't break existing interfaces when making changes, I validate them using unit tests.
 

Users who are viewing this thread

  • Back
    Top Bottom