Results 1 to 4 of 4
  1. #1
    kdestef1 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2021
    Posts
    7

    Nested IIF expression in my report's calculated control

    I've added a checkbox for "Other" to a form where I would like for the formula to exclude/ignore specific text in my specimen type field. Only if the formula does not find the specific text from the formula, then I want it to check the box. In other words I don't want it to check the box if the specimen type = Blood, Stool, Urine, Like Fluid, Bone or CSF, but if the specimen type = Aspirate, for example, then I would want checkbox "Other" checked. My attempt at this formula is below. Using MS Access for MS 365. Thank you!



    =IIf([Specimen Type]<>"Blood",0,IIf([Specimen Type]<>"Stool",0,IIf([Specimen Type]<>"Urine",0,IIf([Specimen Type]<>"Fluid",0,IIf([Specimen Type]<>"Bone",0,IIf(([Specimen Type]<>"CSF",0,[Specimen Type]))))))

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    If expression is to set a checkbox, why would you have [Specimen Type] as a return? Should be -1 (or use True and False words)

    So there are other values than "Aspirate" for which Other should be checked?

    Nested IIf() is not appropriate. Need AND.

    =IIf([Specimen Type]<>"Blood" AND [Specimen Type]<>"Stool" AND [Specimen Type]<>"Urine" AND [Specimen Type]<>"Fluid" AND [Specimen Type]<>"Bone" AND [Specimen Type]<>"CSF", True, False)

    Probably should have a table of specimen types with a Yes/No field to identify as "Other". Include this field in combobx to select type and expression references that combobox column or include table in query and bind checkbox to field (locked so can't edit).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kdestef1 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2021
    Posts
    7
    thanks June 7, it could return more than just Aspirate, as I mentioned, it was an example. I want a checked box for anything other than Blood, Stool, Urine, Fluid, Bone or CSF. Thanks, I think I have the gist of what needs correcting. Appreciate the quick response!

  4. #4
    kdestef1 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2021
    Posts
    7
    June 7 that worked, thanks again!

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

Similar Threads

  1. Calculated Date Column with Nested IF/OR statements
    By c.d.power in forum SharePoint
    Replies: 7
    Last Post: 03-22-2020, 02:43 PM
  2. Workaround for calculated control from report to new report
    By tbjmobile@gmail.com in forum Access
    Replies: 6
    Last Post: 02-27-2018, 07:15 AM
  3. nested IIF BETWEEN AND EXPRESSION
    By sichilaba in forum Forms
    Replies: 1
    Last Post: 03-30-2015, 03:36 AM
  4. Replies: 1
    Last Post: 08-13-2013, 10:06 AM
  5. Calculated expression in report
    By Grizz2 in forum Reports
    Replies: 3
    Last Post: 12-20-2010, 08:50 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