Multiplication factor design

  • Thread starter Thread starter pierre
  • Start date Start date
P

pierre

Hi all,

I have a program i use for different customer
Depending on the customer i want to multiply or not the price by 1%

My price table is
part | price

My data table is
part | qt

Everything report, form,is done from one querie.

I dont want to add a function in the query to get a multiplication
factor, since i think it will slow down the whole thing. Am i right
saying that? (It still look the best way to me so far)

I dont want to multiply the price by 1.01 in fact i dont want to touch
the tblDat. I just want to change a number somewhere and everything
should follow.

If i add a field to describe the customer type in the data table, it
will be repeated each line of the database and would be redundant
Also someone can change it by error

What is the correct way to handle multiplication factor?
regards,
Pierre
 
@weber.videotron.net:

Depending on the customer i want to multiply or not the price by 1%

UPDATE MyTable
SET Price = 1.01 * Price
WHERE Customer = "Eric"
I dont want to add a function in the query to get a multiplication
factor, since i think it will slow down the whole thing.

A multiplication in memory takes a fraction of the time taken by fetching
the stuff off the disk in the first place. An update query like the one
above will not be very slow.
I dont want to multiply the price by 1.01 in fact i dont want to touch
the tblDat. I just want to change a number somewhere and everything
should follow.

Like where then? You can see the new price on the form by either:

- using the ControlSource on the form, try something like
=Iif(Customer="Eric", Price * 1.01, Price)

- using the query underlying the form
SELECT This, That, TheOther,
Iif(Customer="Eric", Price * 1.01, Price) AS PriceAdjusted
FROM etc etc

This will only display an adjusted version to the user: you may want to
make it obvious in some other way, like changing the colour of the
textbox etc.
If i add a field to describe the customer type in the data table, it
will be repeated each line of the database and would be redundant

How do you know which customers are to be munged and which not? Do you
have a separate table of CustomersToBeShownAnIncreasedPrice, in which
case you can do everything in the query by adding a subselect IN clause.

If you can post more details of what you are actually trying to do, it
might help.

Tim F
 
Back
Top