Results 1 to 3 of 3
  1. #1
    jrub is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    4

    Query Design to Produce Calculated Value Using Previous Record Value

    Good Morning All,



    I am in need of some dire help.

    I would like to build a query that has a calculated field, involving value from a previous record. I have five columns, Year (sorted ascending), InvestmentRate, StartingBalance, AnnualContribution, and InterestIncome.

    The first row, being the smallest year value, uses a previously defined elsewhere starting balance, annual contribution, and interest income. This is recognized via an Iif statement and establishing the first set of values which the second row should use to calculate.

    The second record, and until the end of the query, automatically calculates the new starting balance value based on the sum previous row record's starting balance, annual contribution, and interest income.

    Furthermore, for the second record, and untill the end of the query, the InterestIncome is calculated value incorporating the second row's StartingBalance value (which is the product of the sum of the previous record's values).

    This calculated referencing to the previous record is causing me nightmares, if any out there can help, I would be so appreciative.


    Click image for larger version. 

Name:	test1.png 
Views:	10 
Size:	17.6 KB 
ID:	10916

  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,521
    Try adapting this to either return the calculated value or all 3 fields:

    http://allenbrowne.com/subquery-01.html#AnotherRecord
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jrub is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    4
    Holy man, will try this out. I'm a noob so this seems overwhelming. I'll give it a go and report back in a bit.

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

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Replies: 17
    Last Post: 09-24-2012, 08:42 AM
  3. Replies: 2
    Last Post: 06-05-2012, 08:31 PM
  4. Replies: 3
    Last Post: 11-23-2011, 12:25 AM
  5. Using calculated value from previous register
    By eduardo10 in forum Access
    Replies: 2
    Last Post: 08-19-2011, 12:09 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