Results 1 to 4 of 4
  1. #1
    peter_lawton is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2009
    Location
    London
    Posts
    29

    Nesting IIf query

    I currently have a field in a query set as



    ActualPublishersShare: IIf([INCOME TYPE] Like "Perf*","0.005","0.0025")*100

    This works very nicely

    I need to include a "Sync*" parameter

    I've tried

    ActualPublishersShare: (IIf([INCOME TYPE] Like "Perf*","0.005","0.0025")*100), (IIf([INCOME TYPE] Like "Sync*","0.005","0.0025")*100)

    and

    ActualPublishersShare: IIf(Eval([INCOME TYPE] Like ("Perf*", “Sync*)),"0.005","0.0025")*100

    plus other small variations. Access usually tells me I'm using too many parentheses but I'm sure it's not that (I've tried jsut about every possible combination). I pretty sure I'm making an elementary mistake in understanding the syntax.

    If someone could elucidate I'd be very grateful

    Peter

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    If I understand the goal correctly, try

    IIf([INCOME TYPE] Like "Perf*" OR [INCOME TYPE] Like "Sync*","0.005","0.0025")*100

    Given that you're performing math, I don't think you want the numeric values in quotes.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    peter_lawton is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2009
    Location
    London
    Posts
    29

    Solved

    Thank you very much Sir. That worked perfectly (even with the quotes!)

    peter

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    No problem, glad it worked for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

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