Today, I spent the bulk of my time reviewing and refining the database design, which is quite a feat when I'm trying to give it enough flexibility for several variables that may come in play.
Background:In this thread, there was a side discussion about how to handle situation where you do not have complete certainty about what attribute you want to assign to an entity.
I initially used a series of one-one tables to represent otherwise incompatible attributes assigned to entity (in this case, the entity is a person, and the attributes describe something about the person's role). After analyzing the hypothetical personnel database with the problem in that thread, The_Doc_Man made a suggestion of enumerating the attributes as records in a table rather than as fields and demonstrated that I had de-normalized my design when I used the one-one tables.
As I turned to the problem of how I would adopt The_Doc_Man's proposal and make the entry forms work, now that I no longer have fields, I had an idea. A very dangerous idea. Consider this: I can never be sure what attributes I will require from my users since the roles may be modified on a periodical basis, not to think of possible new roles added or taken away as my company's services expands. We have several contracts, some which are concurrent, allowing for overlap of our services, and provide different services, depending on what contract we have at the time.
Therefore, I thought of de-normalized temporary table that generate the fields that will answer each attribute given to a role, *and* define the field's properties (such as required, validation rule, validation text, caption, and input mask) as the temporary table is being created, then bind a blank form (probably a datasheet for presentation reasons) to the temporary table which would enforce the data validation with meaningful data, appropriate input mask and descriptive captions. Once the data entry is done, the de-normalized table then feeds into the junction table that represents "answers" to each attributes for a given role for a given person (and can be done same for every service for any contract as well), re-normalizing the data.
So, if I'm not mistaken, this means I've abstracted away the information about a role (or any given entity that may have its attributes stored in a like manner). Therefore, modifying existing roles and adding new roles is now a trivial problem.
But I said it was dangerous because I know that some has asked for "dynamic tables" in past as a means to get around the normalization and would definitely want to consider the possibility that the idea could be very bad as it'd just obfuscate the even more deeper flaws with your database design.
Then there's another consideration. Since I've abstracted away the attributes of an given entity, it seems perfectly logical that I should also abstract away the record's reference within VBA. That's where I got confused. When I was thinking about how I would refer to certain records in lookup tables, I thought of creating a list of global constants (I say global because I'm not 100% sure yet how broad scope I will need at this point; it may end up as a private constant but I digress) but this presented me with a problem: If I'm going to list constants of ID for lookup records, why even have a lookup table at all?
When I tripped over that question, it bought me to another thought; any Access MVP will tell you that Access is not a appropriate program if you want or need a n-tiered architecture, as Access wraps together the presentation and data access layer. If I'm now abstracting away the entities and thus require my forms to be able to handle such degree of generality, would I be better off with a proper n-tiered program to handle this?
So to wrap my long post, the two questions needs to be answered:
1) Is it appropriate to abstract away what otherwise be a "table" when you cannot be sure about what should constitutes its fields?
2) If a high level of abstraction is needed, is Access capable of handling such, and exactly when we should be considering other solution?
Background:In this thread, there was a side discussion about how to handle situation where you do not have complete certainty about what attribute you want to assign to an entity.
I initially used a series of one-one tables to represent otherwise incompatible attributes assigned to entity (in this case, the entity is a person, and the attributes describe something about the person's role). After analyzing the hypothetical personnel database with the problem in that thread, The_Doc_Man made a suggestion of enumerating the attributes as records in a table rather than as fields and demonstrated that I had de-normalized my design when I used the one-one tables.
As I turned to the problem of how I would adopt The_Doc_Man's proposal and make the entry forms work, now that I no longer have fields, I had an idea. A very dangerous idea. Consider this: I can never be sure what attributes I will require from my users since the roles may be modified on a periodical basis, not to think of possible new roles added or taken away as my company's services expands. We have several contracts, some which are concurrent, allowing for overlap of our services, and provide different services, depending on what contract we have at the time.
Therefore, I thought of de-normalized temporary table that generate the fields that will answer each attribute given to a role, *and* define the field's properties (such as required, validation rule, validation text, caption, and input mask) as the temporary table is being created, then bind a blank form (probably a datasheet for presentation reasons) to the temporary table which would enforce the data validation with meaningful data, appropriate input mask and descriptive captions. Once the data entry is done, the de-normalized table then feeds into the junction table that represents "answers" to each attributes for a given role for a given person (and can be done same for every service for any contract as well), re-normalizing the data.
So, if I'm not mistaken, this means I've abstracted away the information about a role (or any given entity that may have its attributes stored in a like manner). Therefore, modifying existing roles and adding new roles is now a trivial problem.
But I said it was dangerous because I know that some has asked for "dynamic tables" in past as a means to get around the normalization and would definitely want to consider the possibility that the idea could be very bad as it'd just obfuscate the even more deeper flaws with your database design.
Then there's another consideration. Since I've abstracted away the attributes of an given entity, it seems perfectly logical that I should also abstract away the record's reference within VBA. That's where I got confused. When I was thinking about how I would refer to certain records in lookup tables, I thought of creating a list of global constants (I say global because I'm not 100% sure yet how broad scope I will need at this point; it may end up as a private constant but I digress) but this presented me with a problem: If I'm going to list constants of ID for lookup records, why even have a lookup table at all?
When I tripped over that question, it bought me to another thought; any Access MVP will tell you that Access is not a appropriate program if you want or need a n-tiered architecture, as Access wraps together the presentation and data access layer. If I'm now abstracting away the entities and thus require my forms to be able to handle such degree of generality, would I be better off with a proper n-tiered program to handle this?
So to wrap my long post, the two questions needs to be answered:
1) Is it appropriate to abstract away what otherwise be a "table" when you cannot be sure about what should constitutes its fields?
2) If a high level of abstraction is needed, is Access capable of handling such, and exactly when we should be considering other solution?