February 12th, 2013, 03:15 PM
Calculate Value Using Previous Record's Calculated Form Data
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.
February 12th, 2013, 06:52 PM
Is this a sum of all of the previous records, or only those viewed in this session by the user?
February 13th, 2013, 10:42 AM
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.
February 13th, 2013, 12:05 PM
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
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.
February 13th, 2013, 12:48 PM
I think I see the solution coming together, could you elaborate on the global variable a bit?
February 15th, 2013, 06:07 AM
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.
By heinm51 in forum Microsoft Access Help
Last Post: November 12th, 2010, 04:49 PM
By markos in forum Microsoft Access Help
Last Post: November 11th, 2008, 08:55 AM
By thesizz in forum Microsoft Access Help
Last Post: January 28th, 2007, 09:16 PM
By Matt71 in forum Microsoft Access Help
Last Post: September 15th, 2004, 11:12 AM
By skwilliams in forum Microsoft Access Help
Last Post: August 27th, 2004, 02:03 PM