Hey guys. I wanna ask the pros around here what they think about my design. It's about master lists that contain columns of data that may change over time. Let me describe my problem:
I have a master table called tbmInventory. It's got the following fields.
-InventoryID (PK, Text)
-InventoryName (Text)
I have another master table called tbmInventoryPrice that will account for price changes that are specific to each InventoryID. It's got the following fields.
-InventoryID (Compound PK, Text, FK related to tbmInventory)
-DateID (Compound PK, Date/Time)
-InventoryPrice
I have a transaction table called tbtInventory. It's got the following fields (This table is actually normalized into a header transaction table and a detail transaction table, but I think we can omit this fact for this thread).
-TransactionID
-TransactionDate
-InventoryID (FK related to tbmInventory, not related to tbmInventoryPrice)
-InventoryPrice
My current approach to applying the correct price for a particular InventoryID based on TransactionDate is:
a. Encode values in TransactionDate and InventoryID in the tbtInventory's form.
b. A Form_AfterInsert event fires.
c. In the Form_AfterInsert event, I placed a code that will lookup the price of the InventoryID in the tbmInventoryPrice table. The code should find the correct price for the date that is closest to the transaction's date.
Now, I know that this is a glaring violation of normalization, which states that "calculations" should not be stored as static values in permanent table fields. While I can design a query that will dynamically display the correct prices for all InventoryID's (thereby eliminating the InventoryPrice field in tbtInventory), I nevertheless avoided this kind of design because I am aware that my database will soon get populated by numerous records and such query might make database performance suffer.
QUESTION: Can I maintain my current design, whereby InventoryPrice is looked up in the tbmInventoryPrice by VBA code, and placed as a permanent, static value in tbtInventory? Or is this a major database design flaw and am I missing anything?
Thanks guys and I'm hoping to get a reply.