Calculating Fields

MLife

Registered User.
Local time
Today, 19:26
Joined
Apr 2, 2003
Messages
13
Hi,i have a subform where each line has (Cd ID,Cd Title.....CD Price,CD Quantity) and ive added a text box on each line to calculate the price of the line ie (Price * Quantity),how do i make it calcilate that for each seperate line as currently my sum calculates all the fields in the form rather than the one line.

Thanks
 
Unless I am totally missing something, in your unbound text field in your detail section you would put:

=[CD Price]*[CD Quantity]

and that should calculate for each record.
 
I need it to calculate it for each seperate line within the record though
 
Okay....

What about adding another field to your table called CD Total.

On the AfterUpdate Event of both CD Price and CD Quantity you would put the code:

Me.[CD Total] = Me.[CD Price] * Me.[CD Quantity]

That way you have the total for each line and it would be available to run a sum for the report. (Access doesn't seem to allow calculations on an already calculated field)

Hope that helps.....
 
You should not store calculated fields nor is it necessary.
=[CD Price]*[CD Quantity] will give the line total =Sum([CDPrice])*Sum([CDQuantity]]) will give the total
 

Users who are viewing this thread

Back
Top Bottom