Results 1 to 7 of 7
  1. #1
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15

    calculated field

    If i have a price of an item and i want to make another field in a report to meet a specific criteria how would i go about doing this



    if items price is greater than 20 than discount it by 4% if its < 20 than only 2 % but i dont want to show the discount i want to show the sale price

    here is what i came up with does this look close

    =iif[price],>20*0.04,<20 * 0.02) but its showing up like the discount from the price instead of the total like for example 15.00 * 0.04 is .060 discount but i want it to show 14.40 instead

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe try:
    Code:
    =iif([price]>20, [price]*0.04, [price] * 0.02)

  3. #3
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15
    I have attached just the report but the code you provided is doing the same thing
    Attached Files Attached Files

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Oops sorry....

    You can take the discount amount and subtract it from the price:
    Code:
    =[price] - iif([price]>20, [price]*0.04, [price] * 0.02)
    or

    you can use the percentages.. .04 discount is the same as multiplying by .96...
    Code:
    = iif([price]>20, [price]*0.96, [price] * 0.98)

  5. #5
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15
    Steve,

    Thanks this worked great. I need something similar to this but the criteria is a date how would i make an expression for a specific date

    if item has a date posted march 4, 2012 > then discount by 0.03%, if <march 4 2012 then 0.05% discount on the price

  6. #6
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15
    IIF function similar to the other one your helped me with

    I'm referring to my book and another report I have created but its stating that it has to many arguments or something as the error message I think I'm really close
    =[Date Posted]>Date(3/4/2012),[Price]-[price]*0.03,[Price]-[price]*0.05

    if the date posted is > date(3/4/2012) then Price- price *0.03 if not then price-price*0.05

    I can say it but just dont know where I'm going wrong

  7. #7
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    =IIF([Date Posted]>#3/4/2012#,[Price]-([price]*0.03),[Price]-([price]*0.05))

    Try this.



Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 12-15-2013, 02:29 AM
  2. Replies: 1
    Last Post: 04-21-2013, 03:20 PM
  3. Replies: 3
    Last Post: 02-13-2013, 10:15 AM
  4. Calculated Field
    By MikeDBMan in forum Database Design
    Replies: 1
    Last Post: 03-26-2012, 03:06 PM
  5. Calculated field help
    By eds in forum Access
    Replies: 2
    Last Post: 07-18-2011, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums