Results 1 to 3 of 3
2004-10-04, 18:32 #1
- Join Date
- Jun 2003
- Camp Lejeune, North Carolina, USA
- Thanked 0 Times in 0 Posts
Calculated total (Access 2000 Service Pack 3)
I have created a form which my staff enter test scores into. The form was created off of a table first with the same fields. However, on the form I made the grand total column automatically add up the totals from 1 person's test which has part 1, 2, and 3 for each patient. This works very well because I know the computer does not add incorrectly.
The test is given before treatment and after treatment. As mentioned above the Pre and Post Test has 3 parts which we want the grand total of the Pretest (part1, 2, & 3) and Post Test (part 1, 2, 3). Because they only enter the totals for each part and not the grandtotal, the Outcome studies table does not post the grandtotal for Pre and Post.
I know it has to do with the grandtotal field being calculated in the entry form. How do I make the table read the automatically entered total from the grandtotal on entry form?
Now, I know I have totally confused everyone.
I pull my queryies from the table and want to graph the progress between entry test score total and exit test score total.
Thank you for any help. <img src=/S/brainwash.gif border=0 alt=brainwash width=15 height=15>
2004-10-04, 18:40 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: Calculated total (Access 2000 Service Pack 3)
The standard advice is not to store calculated data in a table, since (a) it is redundant and ([img]/forums/images/smilies/cool.gif[/img] it can easily be recalculated each time you need it. Instead, create a query based on the table, and add calculated columns to compute the totals. That way, even if a score has to be corrected afterwards, the totals will still be correct, because they will be recalculated each time.
There are some exceptions to the above. If recalculating the values each time you need them is very time-consuming, and if the underlying values change rarely after they have been entered, you can add fields for these values to the table. You can fill those fields in the Before Update event of the form. (You must NEVER allow users to modify or enter values in the table directly). The code would look like this, of course with the appropriate names substituted:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.StoredPreTotal = Me.CalculatedPreTotal
Me.StoredPostTotal = Me.CalculatedPostTotal
2004-10-04, 20:07 #3
- Join Date
- Dec 2000
- Sacramento, California, USA
- Thanked 1 Time in 1 Post
Re: Calculated total (Access 2000 Service Pack 3)<hr>I know the computer does not add incorrectly.<hr>This is not necessarily true. It depends on the datatypes you're dealing with. Floating point error occur in simple addition and subtraction when using Single or Double datatypes.Charlotte