Access2003/Table/Feilds i want to Solve that Sales= Rate* Quantit.

A

Ased

i want to calculate the result of two fields let say that i have rate and
Quantity of one item and wants to have Sales automaticlly please halp me to
do so.
 
A

Allen Browne

There is a really simple way to do this in Access, and it can never go
wrong.

The solution is to create a query using this table.
In query design type this into the Field row:
Amount: [Rate] * [Quantity]
This gives you a field named Amount.
Now use this query (rather than the table) wherever you need the Amount
column in your database (e.g. for forms and reports.)

Technically, this is the only normalized solution. For more information,
see:
Calculated fields
at:
http://allenbrowne.com/casu-14.html
 
A

aaron.kempf

bullshit you fucking con artist.

There are _TEN_ different ways that this flaky method can go wrong:

a) uh if you want to use the same field name, you're screwed.
b) if the formula changes you need to change it in 10 different places
c) what if you need to do this for 2 different fields? then you stack
query on top of query?
d) what happens when query on top of query randomly flakes out?
e) what happens when you have 12 different copies of this formuls.
Maintenance is a different direction than duplication
f) if you have a calculation on this field; you're going to scan the
whole table

I don't believe that a chatroom like this-- is the best place to learn
Database Best Practices.

I mean this fucking dipshit just told you to put it in a query.

Where you _REALLY_ should put this-- is a computed _COLUMN_ in SQL
Server. That way; if you ever need to change it-- it is just in one
place.

If you want to index the results so that it would be easier to 'Give
me all the lineitems that are more than $1000'.

DONE.

Which would you rather be?

_DONE_ with the question? Or still scanning a table through 12
different layers?



There is a really simple way to do this in Access, and it can never go
wrong.

The solution is to create a query using this table.
In query design type this into the Field row:
    Amount: [Rate] * [Quantity]
This gives you a field named Amount.
Now use this query (rather than the table) wherever you need the Amount
column in your database (e.g. for forms and reports.)

Technically, this is the only normalized solution. For more information,
see:
    Calculated fields
at:
   http://allenbrowne.com/casu-14.html

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




i want to calculate the result of two fields let say that i have rate and
Quantity of one item and wants to have Sales automaticlly please halp me
to
do so.- Hide quoted text -

- Show quoted text -
 

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