riktek
Member
- Local time
- Yesterday, 22:27
- Joined
- Dec 15, 2023
- Messages
- 64
I've been refactoring a number of projects and migrating generalized code to a library ACCDB over time. It's gone practically without a hitch and many ACCDB projects reference it and instance its classes like a charm.
As this refactoring has progressed, I have encountered one difficulty, however. The standard code depends on a small number of standardized functions to do project-specific things, chiefly object name transformations. These functions are public and have identical names and parameters from one project to the next, so as to work with the common code. They reside in a local standard module in each project. The only difference is that one project might need to conditionally return "blue" or "yellow" for parameter "green", and the next project might need to return "tacos" or "sushi" for parameter "dinner" on other conditions. I.e., the functions all have a common interface.
The problem, now that I've migrated the common calling code to the library, is that it regards the public procedures in the local standard module to be undefined.
I should add that the calling code is in library classes that local objects instance and bind themselves to for configuration. It isn't clear to me what the scope and visibility of those class instances is, beyond not seeing local standard modules.
The question is how to get procedures in a library class to recognize public procedures in a local standard module. I.e., this isn't a question of getting the primary ACCDB to work successfully with code in a library ACCDB, but of getting the library ACCDB to reciprocally work successfully with primary ACCDB code.
The VBE offers the option of adding a reciprocal reference to the primary ACCDB in the library ACCDB. It isn't clear to me whether that is a good idea in the to begin with, or if so whether that would persist if done while running the primary ACCDB. It seems clumsy to open the library ACCDB to add references to each project that might reference it. An alternative might be somehow to create the reciprocal reference programmatically on startup but I'm not clear where to start with that. Perhaps the instancing must be done differently to achieve the necessary visibility. Perhaps it would be best somehow to create a local class implementing a library interface class, but this starts getting wooly and may still beg the question of visibility. Regardless, Google isn't much help and I'm in the realm of casting about and not knowing what I don't know, so it seems best to ask. Any thoughts or direction would be welcome.
As this refactoring has progressed, I have encountered one difficulty, however. The standard code depends on a small number of standardized functions to do project-specific things, chiefly object name transformations. These functions are public and have identical names and parameters from one project to the next, so as to work with the common code. They reside in a local standard module in each project. The only difference is that one project might need to conditionally return "blue" or "yellow" for parameter "green", and the next project might need to return "tacos" or "sushi" for parameter "dinner" on other conditions. I.e., the functions all have a common interface.
The problem, now that I've migrated the common calling code to the library, is that it regards the public procedures in the local standard module to be undefined.
I should add that the calling code is in library classes that local objects instance and bind themselves to for configuration. It isn't clear to me what the scope and visibility of those class instances is, beyond not seeing local standard modules.
The question is how to get procedures in a library class to recognize public procedures in a local standard module. I.e., this isn't a question of getting the primary ACCDB to work successfully with code in a library ACCDB, but of getting the library ACCDB to reciprocally work successfully with primary ACCDB code.
The VBE offers the option of adding a reciprocal reference to the primary ACCDB in the library ACCDB. It isn't clear to me whether that is a good idea in the to begin with, or if so whether that would persist if done while running the primary ACCDB. It seems clumsy to open the library ACCDB to add references to each project that might reference it. An alternative might be somehow to create the reciprocal reference programmatically on startup but I'm not clear where to start with that. Perhaps the instancing must be done differently to achieve the necessary visibility. Perhaps it would be best somehow to create a local class implementing a library interface class, but this starts getting wooly and may still beg the question of visibility. Regardless, Google isn't much help and I'm in the realm of casting about and not knowing what I don't know, so it seems best to ask. Any thoughts or direction would be welcome.
Last edited: