Results 1 to 3 of 3
  1. #1
    jree3000 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    40

    Calculating fields using iif and checkbox value

    Hello!

    I'm working on a query that I need some expert advise on. I have fields that are set up to calculate value based on other fields. These are working fine. Problem is I want to add a condition that is based on a checkbox field and I'm not sure how to do that. Right now my query field looks like this:

    Code:
    RUP1_TotalParticles: [RUP1_particles]*[RUP1_TotalVol]
    It returns the appropriate number based on the value of those fields. Now I also have a checkbox field called "RUP_good". I only want the RUP1_TotalParticles field to calculate if the RUP_good field is checked to yes (true). If it is not checked to yes, I want it to return a value of 0. Hopefully that makes sense.

    I'm pretty sure I can do this using the IIf function but I'm a novice and not quite sure how to structure that properly. Thanks in advance for any help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    IIf() in plain English:

    If condition is true do this else do this.

    Try:

    RUP1_TotalParticles: IIf([RUP_good], [RUP1_particles]*[RUP1_TotalVol], 0)
    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
    jree3000 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    40
    That did it! Thank you, June7!

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

Similar Threads

  1. Expressions for calculating Text fields
    By drnld in forum Access
    Replies: 4
    Last Post: 05-27-2014, 10:45 AM
  2. Calculating subform fields
    By Tvanduzee in forum Forms
    Replies: 25
    Last Post: 09-17-2012, 06:42 AM
  3. Replies: 0
    Last Post: 03-09-2012, 07:04 AM
  4. calculating time fields
    By donnan33 in forum Programming
    Replies: 5
    Last Post: 01-19-2012, 12:15 PM
  5. Calculating null fields in a form
    By chu3w in forum Forms
    Replies: 1
    Last Post: 02-26-2010, 02:00 PM

Tags for this Thread

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