=[QTY]*[Price Per Unit] Need Help Please

  • Thread starter just a little rusty
  • Start date
J

just a little rusty

The below formula works great but, what if I want the total from this formula
to report into my table? For example:

=[QTY]*[Price Per Unit]

Price: 5.00
Qty: 2
Total: 10.00

The Price and Qty will report to my table but no sum. I know what is wrong
I have a formula in the control field. But how do I get both the heading of
the table and the formula to work in the control field at the same time? It
has been a wile sence i took this in school and my mind is starting to get a
little rusty. This is proby going to be a simple fix and ill feel stupid for
asking when i get the answer. Thanks
 
R

Rick Brandt

The below formula works great but, what if I want the total from this
formula to report into my table? For example:

=[QTY]*[Price Per Unit]

Price: 5.00
Qty: 2
Total: 10.00

The Price and Qty will report to my table but no sum. I know what is
wrong I have a formula in the control field. But how do I get both the
heading of the table and the formula to work in the control field at the
same time? It has been a wile sence i took this in school and my mind
is starting to get a little rusty. This is proby going to be a simple
fix and ill feel stupid for asking when i get the answer. Thanks

The correct answer is "you don't". Derived data should not be stored,
but rather calculated on-the-fly as needed (just as you are in your form).

If you don't want to re-write that expression over and over create a
SELECT query that is basically all of the fields from your table plus an
additional one with the calculation in it. Then just use that query
every place you would otherwise have used the table.
 
A

Al Campagna

Rusty,
As a general rule, and in this instance, you would not create a field in
your table to store the PriceTotal.
Since you capture the Qty and the Price, you can always recalculate the
PriceTotal, "on the fly", in any subsequent form, query or report.That's the correct way to do that... with just a calculated unbound text
control.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

just a little rusty said:
The below formula works great but, what if I want the total from this
formula
to report into my table? For example:

=[QTY]*[Price Per Unit]

Price: 5.00
Qty: 2
Total: 10.00

The Price and Qty will report to my table but no sum. I know what is
wrong
I have a formula in the control field. But how do I get both the heading
of
the table and the formula to work in the control field at the same time?
It
has been a wile sence i took this in school and my mind is starting to get
a
little rusty. This is proby going to be a simple fix and ill feel stupid
for
asking when i get the answer. Thanks
 
J

Jeff Boyce

Rick and Al have already urged you not to...

Here's one of the rationales for why you don't really want to -- if you
store a calculated/derived value in your table and then any change is made
to any of the pieces of the calculation and/or total, the numbers are out of
sync. Do you really want to create all the code you'd need to ensure that
the values stay synchronized ... or just use the query Rick & Al are
suggesting to re-calc the total on the fly?

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

boblarson

And if you are concerned about having to do this everytime you want the value
(what Al, Rick and Jeff said), you can create a BASE query which is basically
the table with the extra calculated field and then you can use that in all
the various places you need instead of the table so then you have the
calculated field when you need it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top