Results 1 to 9 of 9
  1. #1
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113

    Adviced on Archiving Old Data

    Hello, Here is my Problem:
    I need to change the price of many parts, the problem is that if I change the value of Price, then all the records in the table orders which had the old price also make the change. Is there a way of only affecting the change to new records and not to the old ones? Should I make an Archive Table or it will be affected as well? Thank you for your help.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Typically the orders table would include the price applicable to that order.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113
    Well I guess I didn t design the table properly. How could I make a Field that gets the price for the order and store it. Do you have any advice on how to design such a field? Thank you

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I'd use the second method here when selecting a product:

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113
    Hello, I did read the attachment and your second method is the one I used in the afterupdate event of ProductID. The Prices are stored on the Table OrderDetails.Price, However when I change the price on the Table Product.PriceList Field. The change takes place on all the records that are on the OrderDetails Table as well. Is there a way of storing those values without changing??

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    They should not change. In your relationships, did you specify cascade updates? Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Join Date
    Apr 2017
    Posts
    1,673
    Have a tblPriceLog: PLID, PirceDate, ProductID, Price

    When you need a price for YourProduct at YourDate, you look for topmost record in tblPriceLog with ProductID = YourProduct and PriceDate <= YourDate with records ordered by PriceDate in descending order. The best is to write a function for it - I posted one a couple of days ago in one of forums here.

    Did find the post where I posted the function code:https://www.accessforums.net/showthread.php?t=71025
    Look for ValidValue()

  8. #8
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113
    Hello, I did solve the problem, you were right Paul, I was cascading Updates for that relationship. Now It is working properly. Thank you for your help.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem, glad we got it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Archiving Data by Quarter - Best Solution?
    By warren0127 in forum Access
    Replies: 8
    Last Post: 08-04-2017, 05:53 AM
  2. Archiving Linked Data
    By kevinegg45 in forum Access
    Replies: 3
    Last Post: 01-08-2013, 01:07 PM
  3. Replies: 19
    Last Post: 12-11-2012, 05:51 PM
  4. Archiving records
    By NOTLguy in forum Access
    Replies: 3
    Last Post: 11-21-2010, 03:15 PM
  5. Archiving old records
    By dean in forum Access
    Replies: 7
    Last Post: 09-14-2009, 02:54 AM

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