Skip to main content
April 11, 2011
Question

How to discount a number by a percentage

  • April 11, 2011
  • 1 reply
  • 2107 views

Hi all,

I am trying to think of the best way to discount a number from an access db.

Basically  it's an online hotel room tariff. So if someone clicks they want to  stay 5 nights I want to be able to call the base price from the db and  then times it by 5 and then discount a percentage per night. Or have I  just made this way too complicated and over looked an easier solution.

Thanks

Jonathan

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    April 11, 2011

    The logic seems to be OK. I hope you are following the below steps.

    1. Get the Base price from DB(100 for example)

    2. Multiply it by 5(100 * 5 = 500)

    3. Multiply the discount price by 5(10 * 5 = 50)

    4. Get the difference(500-50 - 450)

    In this way if you want you can display the Total Price, Discount Price and Actual Price to your customer.

    April 11, 2011

    Hi mate,

    Thanks for you reply. sorry i did not make it clear but  what i want is if they stay for say 2 nights they can have a discount of  say 10% and if they stay for say 4 nights they can have a discount of  15% so on and so on.

    maybe i could do what you have done and then  wrap it in a CFIF and then do a few of them with differnt percentage's  do you think that would work?

    Thanks

    Jonathan

    Known Participant
    April 11, 2011

    How many discount tiers are you going to have?  You could put them in a table and do a look up - eg; 2 (nights) 10 (%), 4 (nights) 15 (%) etc.  This would save doing a bunch of if/else statements and having to hard code the values in there.