Results 1 to 4 of 4
  1. #1
    cbuechner is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jan 2021
    Posts
    60

    General Question

    I am looking for a way to save data or even a report, that once written, wont change, even if the background data changes.

    For example, the price of gas is 2$ per gallon. I calculate I need to get 5 gallons a week. I further calculate in a report, that I need to to spend $10.00 a week for gas. The price of gas changes in a month to $3.00 per gallon, and if I run the report, it will tell me based on the new $3.00 per gallon, and not have both.



    Tables stay the same, however, the queries with calculations change based on the table value.

    OR maybe I can have a field that if checked, wont allow changes?

    This is a very simple look at what IM trying to do, but basically, I want to keep the final record, as a historical point.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    See this re AgreedTo Price

    If you store the Product Price with the Product record, you will have difficulty when you change that Price--((all of your historical sales records will change)). To avoid this, you can put the CurrentPrice of the Product in the Product table, and put the ProductID, the AgreedUponPrice and the Quantity in the OrderDetail record.

    AgreedUponPrice is the negotiated Price that you sold this product to this Customer in this Order and that price could include sale price/clearance item/loyalty reward program/special discount.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you need a 'result' table that adds all the elements;

    gasRatePerGal , #gals , Month
    $2 , 10 , Jan-2021

    this table is NOT in a relationship link. Its a historical table that all other tables add to , to 'freeze' the rates.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,837
    based on your example, another way is to store a history of the 'component elements' with an effective from date so for example.

    tblPrices
    PricePK
    ItemFK
    Price
    DateFrom

    So for any calculation requiring a price for an item on a specific date - you would look up the price effective on that date. - i.e. the record which has the highest DateFrom which is less than the date you are looking for.

    Also has the benefit of forward modelling. If you know the price is going up next month, you can enter it now, not wait until it has happened. So a report for this month would show the price effective for this month, the same report run for next month would show next months price.

    depending on complexity, you might also include a timestamp field which will then maintain when a record was changed. So if in the above example when you run next months report you haven't entered the new price, then you do enter it and run the report again, you have the option of two views, the first as the current view (based on datefrom) and the second as the view that was current at the time of the first time the report was run (based on timestamp)

    However there are occasions where you might want to store values which are 'a matter of fact' particularly around invoicing.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. General Question on Switchboards
    By d9pierce1 in forum Access
    Replies: 3
    Last Post: 09-12-2020, 11:56 AM
  2. General Question
    By Gregm66 in forum Access
    Replies: 2
    Last Post: 10-05-2016, 11:10 AM
  3. General Design Question
    By Cuken in forum Database Design
    Replies: 4
    Last Post: 01-11-2013, 04:45 PM
  4. General Question
    By notadbadmin in forum Access
    Replies: 3
    Last Post: 08-03-2011, 08:03 PM
  5. General question
    By dollygg in forum Access
    Replies: 7
    Last Post: 12-11-2009, 05:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums