Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Calculate Value Using Previous Record's Calculated Form Data

Results 1 to 6 of 6
Share This Thread →
  1. #1
    jrub is offline Registered User
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Calculate Value Using Previous Record's Calculated Form Data

    Hi Everyone,

    I'm looking for some help with referring to a previous record in a form and performing calculations with that value.


    In my form, a user can adjust the "Percent" cell percentage to what they like. The neighboring fields, "Contributions" and "Interest" automatically recalculate new values based on the user input for the "Percent" field.

    The "Fund Balance" value is the SUM of the previous record's "Fund Balance" (aka a running sum), along with addition of the previous "Contributions" and the previous "Interest" fields.

    How can I get the "Fund Balance" field to automatically recalculate using data from the previous record's form calculation???

    I am a noob so any help is appreciated, thanks.

  2. #2
    meratigoerr's Avatar
    meratigoerr is offline Contributing User
    Join Date
    Jun 2011
    Location
    South Jersey
    Posts
    544
    Rep Power
    58
    Is this a sum of all of the previous records, or only those viewed in this session by the user?

  3. #3
    jrub is offline Registered User
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0
    Thanks for the reply!

    Only those viewed in the session by the user.
    This is because, of the presented records, the user could change the "Percent Value", which will automatically adjust the "Interest", and thereby needing the "Fund Balance" to be recalculated.

  4. #4
    meratigoerr's Avatar
    meratigoerr is offline Contributing User
    Join Date
    Jun 2011
    Location
    South Jersey
    Posts
    544
    Rep Power
    58
    Create an unbound text box on your form. Set the visible property to false. Set the default value to zero. This text box will store the information from the previous record that you want to recall. When you complete one record and move onto the next you simply add your desired value to the value already saved in the text box. Example

    First record: Saved Value = 0 Value used for running sum = 150
    when you go to the next record, use code to add the running sum value to the saved value

    Second record: Saved Value = 150 Value used for running sum = 75
    run code

    Third record: Saved Value = 225
    and so on....

    Since this is only a temporary value for while the user is logged in during this session, you could also use a global variable to save the value as well.

  5. #5
    jrub is offline Registered User
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0
    I think I see the solution coming together, could you elaborate on the global variable a bit?

    Thanks

  6. #6
    meratigoerr's Avatar
    meratigoerr is offline Contributing User
    Join Date
    Jun 2011
    Location
    South Jersey
    Posts
    544
    Rep Power
    58
    I actually don't use global variable much. You'd be better off just doing a quick google search, a ton on info will come up.

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Trouple Displaying Calculated data from sub form in form
    By heinm51 in forum Microsoft Access Help
    Replies: 3
    Last Post: November 12th, 2010, 04:49 PM
  2. Update record via form and keep previous field data
    By markos in forum Microsoft Access Help
    Replies: 1
    Last Post: November 11th, 2008, 08:55 AM
  3. Having a records calculated field get info from previous record
    By thesizz in forum Microsoft Access Help
    Replies: 1
    Last Post: January 28th, 2007, 09:16 PM
  4. Calculated field utilising data from previous record
    By Matt71 in forum Microsoft Access Help
    Replies: 1
    Last Post: September 15th, 2004, 11:12 AM
  5. Pull data from previous record in tabular form
    By skwilliams in forum Microsoft Access Help
    Replies: 0
    Last Post: August 27th, 2004, 02:03 PM

ASP Free Advertisers and Affiliates