I have a relatively complex application for Access 2007 written in VBA (4 enumerations, 7 modules, 38 class-modules, 86 forms, and a whole slew of tables and queries) . I've found a situation where it would be beneficial to use an Object Factory design, but so far I am unable to find a clean way to implement this type of functionality without the standard abstract/inheritance that is easily accomplished in VB or C#.
Has anyone had any experience implementing a factory design in VBA, and is it even possible? ... Or is there a neat "trick" that can help me obtain the same overall goal?
My experience on factory design is limited to C#, and i've never done it in VB, so maybe there is something in VBA that is common to VB that I am missing.
Example
I will be receiving a specific date. based on that date i will need to calculate anywhere between 2 and 5 other dates. the rules for calculating these dates changes based on the "type" of date being entered.
So if I have a date of 07/15/2009, and this is a type 1 date it would return
07/15/2010 for date 1, 07/15/2011 for date 2, 07/15/2012 for date 3, 06/10/2012 for date 4 and 07/10/2012 for date 5
if i put the same date but put it in as a date type 2 i would get null for date 1, null for date 2, null for date 3, 06/10/2011 for date 4 and 07/10/2011 for date 5
so for each set of rules there will be a minimum of 3 possible max of 6 (for now this could always expand at any time) i will basically be entering a starting date... the rule... and returning an object that will contain all of the date properties.
I hope that helps a little bit.