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
Probably every developper has build some code- or object-library for fast and robust developping of applications.
Most are general error handling, form classes, control classes, ...
Some 40 years I am playing with generalization of Access applications. The problem (or my problem) with Access is that the binding of of controls in the forms is based on the fields in the correspoding tables. But a "control" (I will call it a User-Control) is much more than the way how it is stored. To handle that difference you have the BeforeUpdate and AfterUpdate events of the controls in the form. But that makes the form User-Control dependant, and thus hard to generalize.
I have removed all User-Control dependencies form the forms. Then all forms become "the same", with only the display function of the controls. The result is that I only use two forms: one as a continuous form, the other as unbound.
During opening of the form the controls are positioned, depending on what you want to display.
The binding of the control, to make them a User-Control, is done when a control is entered: User-Control-binding. Then the control in "bound" to the corresponding record in a metadate table in FE. With this record it is completely specified how the control behaves as a User-Control.
Each control is "any" form becomes getrs a controltype. This controltype can be to behave as Label, or Commandbutton, but can also represent a field. In this case the controltype can be far more than the bare fieldtype, for nuanciating how User-Controls function.
Because there is no predominance of forms over controls, forms can be automatically created based on the configuration of controls in the metadata-table. Compare to the "automatic" generation of Datasheet-tables, but now including all the User-Control specifics.
Almost all process to run applications can be automated, and made it specific with User-Control binding.
All these generalized processes are collected in a linked library, and so available to any application.
No need for form classes or control classes, no need of general error handling: each process has its own dedicated error-repairing/reporting functionality.
The central part is the active User-control. Only a couple of the control events are used to react specific to the User-Controltype. A "important" type is the User-Controltype "FK". With this type, representing a link to another table, you can traverse the whole application completely dynamical.
Data integrity is controlled form the metadata-table. So while typing, you can already where problems will occur when changes are written to the tables.
All changes in the metadata-table are logged. With the logged data the backend is automatically synchronized when installing a new version in the production environment. Except for some real problems, I never have to go to the backend.
It is a complete other way of thinking, but now form the User-Control side.