Results 1 to 6 of 6
  1. #1
    bellevue is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2012
    Posts
    61

    Problem with Minimum Price in IIf argument

    I let holiday properties on different Holiday Parks; one of the Parks (let's call it "ABC Holiday Park") has a site pass fee which must be collected with the booking.

    The charge is £12.00 for 1-4 people but for the 5th, 6th, 7th or 8th person (if applicable) it's an additional £3.00 per person.

    I'm trying to write an IIf argument for this formula; however, I want the argument to return a value of £0.00 for all other Holiday Parks, that is those that don't charge a site pass fee.



    So far, I've created the following:

    =IIf([Holiday Park]="ABC Holiday Park",IIf([Occupancy]<=4,"£12.00",IIf([Occupancy]>=5,[Occupancy]*3,"£0.00")))

    It works fine as far as all bookings for ABC Holiday Park are concerned but doesn't return a £0.00 for those non-site pass fee parks.

    Can anyone help please ?

  2. #2
    CGM3 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Atlanta, GA
    Posts
    49
    The way your formula is set up, the "£0.00" can only be returned IF the Park is ABC Holiday Park AND the Occupancy is >=5 AND the Occupancy is also NOT >= 5 (which is about as possible as one of Escher's endless stairways being actually built.)

    Either of these should do the trick (my preference is the second one, which eliminates non-ABC Holiday Parks right off the bat):

    =IIf([Holiday Park]="ABC Holiday Park",IIf([Occupancy]<=4,"£12.00",[Occupancy]*3),"£0.00")

    =IIf([Holiday Park]<>"ABC Holiday Park","£0.00",IIf([Occupancy]<=4,"£12.00",[Occupancy]*3))

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You appear to have the 0 in the False argument of the >= 5 IIf, not the "ABC Holiday Park" IIf (which has no False argument).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    How about
    Code:
    =IIf([Holiday Park]<>"ABC Holiday Park","£0.00",
      IIf([Occupancy]<=4,"£12.00",IIf([Occupancy]>=5,[Occupancy]*3,"£0.00")))
    You didn't say what the fee was for >8 occupants, but your expression has it at "£3.00"/person.

    You have text values for Cost/fee, is that really working?

  5. #5
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    IIf([Holiday Park]="ABC Holiday Park",IIf([Occupancy]<=4,"£12.00",[Occupancy]*3),"£0.00")

    . . . while I was working on this Paul & Orange posted . . . sorry. I think I ended up with what Paul pointed out.

  6. #6
    bellevue is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2012
    Posts
    61
    Thanks ever so much CGM3, pbaldy, orange and particularly Robeen, that's superb and woprks fine. I think my head was getting all "kafuddled" after so many attempts !!

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

Similar Threads

  1. Replies: 1
    Last Post: 04-02-2012, 04:20 PM
  2. Replies: 5
    Last Post: 03-25-2012, 03:27 AM
  3. Criteria for a minimum itself
    By hawkins in forum Access
    Replies: 17
    Last Post: 07-27-2011, 12:57 PM
  4. one-to-many-or-none table relationship? (minimum cardinality)
    By racecar333 in forum Database Design
    Replies: 2
    Last Post: 02-24-2011, 07:11 AM
  5. Can't see minimum or maximum buttons?!?
    By Felix_too in forum Forms
    Replies: 2
    Last Post: 12-29-2010, 10:04 AM

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