Record Values made by Product of 2 other fields

She just means: put the calculation in a textbox's ControlSource.

i.e.

=[txtQuantity] * [txtPrice]
 
Only1Abhi said:
I learnt it in skool aswell
1NF, 2NF and then 3NF

Thanks for that!
See i allways said school is good for nothing....
:(

Regards
 
namliam said:
See i allways said school is good for nothing..

It's "skool!" :p
 
Pat said base the form on a query and not the actual table.

Do I need to add any other fields in the query?
I mean calculated fields?

And if yes, what kind of forumlae (or criteria) goes with it?


It's skool!

S-cool is soo cool! :p

http://www.s-cool.co.uk/
 
You don't need the calculation in the query as you are performing it on your form.
 
but doesn't that just display the calculated value on the form?

I need to store it aswell!

Thanks!
 
Bloody Hell people... What is it?
One of the 10 Access commandments? (lol)


If I shouldn't store calculated values...
Then what's the alternative?
 
lol Mile...


No I'm not...

But what's the alternative?
 
Please...enlighten us as to why you need to store this calculation in a table. :cool:
 
I need to print out the records.

If I don't have the value calulated and STORED, then I'll have to work out each and every record one at a time and type it.


That's why!
 
lol, you can also do the calculation in a report.

Absolutely NO need to store it in a table.
 
People Killing People Dying
Children Hurting and even crying
Can you practice what u breach?
When U start learning Peach?

Father Father Mile-O-Phile please help us...
We need some guidance from above...
Can you please please tell me...
Where is the love?

(I mean how can I do calculation on report)?


Thanks!
:p
 
The EXACT same way you would do it on a form. Put a textbox on and put the expression in its ControlSource.
 
hey Mile-O-Phile-Out,


I have a problem bro. I need the Total field to change INSTANTLY. Because I may want to change the Amount & Qty fields to see what changes it brings on the Total.


So that's a good reason to store the calculated value...

Now you're gonna say:

THOU SHALL NOT STORE CALCULATED VALUES

Then what's the alternative?
And now I have a good reason to NOT use report calculations.

Please help.
Many thanks!

Kind Regards,
Abhi
:p :p
 
We seem to have come back to my solution. I am supprised that no one understood it well enough to explain it to you. Make a query that selects the columns you need and that calculates the total:

Select fld1, fld1, Price, Qty, Nz(Price,0) * Nz(Qty,0) As Total
From YourTable
Order By fld1;


Change the form's RecordSource to this saved querydef. You will then see the new column - Total in the field list. Bind it to a control by choosing it as the ControlSource for a control. This value will NOT be stored in the underlying table. It simply exists in the query and can be displayed on the form or in a report.

When you change either price or quantity, the total field will re-calculate. You simply have to understand the time frame of "immediately". Access needs to know that you have finished typeing in the textbox that you are changing before it can use the result to recalculate the Total. Therefore, the cursor needs to leave the changed field.

The calculation in a query has a decided advantage when you want to display the value on a continuous form. Since the Total field is unbound if it's controlSource is a calculation, you can't show the extended amounts for each line item by using this method. But, you CAN calculate the extended amt in the query and then it will show for each line item.
 
Actually the cursor does not necessarily have to leave the changed field to show you the result. You can use the OnChange Event for either the 'Qty' or the 'Amount' fields and show a message box with Nz(Amount,0) * Qty.Text (putting an error trap in case Qty is Null). Whenever you change one digit of Qty, a message box will pop-up with the instantaneous result, but Access won't store the result in the Total field until you leave the field. Not sure if that's what Only1Abhi had in mind though.

This was a very amusing thread by the way. Thoroughly enjoyable.
 

Users who are viewing this thread

Back
Top Bottom